5 # This makefile is maintained by Greg King <greg.king4@verizon.net>.
7 # Goals that are supported by the cc65 package
8 .PHONY: all bins libs docs samples tests clean zap
9 .PHONY: uninstall install install-bins install-libs install-docs
11 # If SYS is defined on this makefile's command-line, then we want it to go
12 # to "samples" and "tests", but not to the other rules. So, we disable a
13 # feature of GNU make that would have given ${SYS} to every sub-make.
16 # The install prefix and directories
18 exec_prefix = $(prefix)
20 bindir = $(exec_prefix)/bin
21 datadir = $(prefix)/share
22 docdir = $(datadir)/doc
23 libdir = $(exec_prefix)/lib
25 CC65DATA = $(libdir)/cc65
26 CC65DOC = $(docdir)/cc65
28 CC65ASM = $(CC65DATA)/asminc
29 CC65INC = $(CC65DATA)/include
30 CC65LIB = $(CC65DATA)/lib
36 # BSD-like install-script/-program
37 INSTALL = make/install-sh
39 INSTALL_DATA = $(INSTALL) -c -m 644
40 INSTALL_PROG = $(INSTALL) -c -m 755
41 INSTALL_STRIP = $(INSTALL_PROG) -s
43 # This file-name extension is needed on DOS/Windows systems.
50 # The sample and library-test programs must be compiled for only one platform
51 # at a time. So, those rules are done automatically only when a user names
52 # a system on the command-line. (A user can do those rules with their
53 # defaults by putting "all samples tests" on the command-line.)
55 all: bins libs docs $(SYS:%=samples tests)
58 @$(MAKE) -C src -f make/gcc.mak CC65_INC=\\\"${CC65INC}/\\\" CC65_LIB=\\\"${CC65LIB}/\\\"
63 # This rule won't try to generate HTML files
64 # if a host system doesn't have LinuxDoc Tools.
66 @if linuxdoc -B check doc/index >/dev/null 2>&1; \
67 then $(MAKE) -C doc html; \
68 else echo '"LinuxDoc Tools" is not installed; skipping HTML documentation.'; \
71 # Some platforms cannot compile all of the sample and library-test programs.
72 # So, these rules ignore errors.
75 -@$(MAKE) -k -C samples prefix=$(prefix) $(SYS:%=SYS=%)
78 -@$(MAKE) -k -C testcode/lib prefix=$(prefix) $(SYS:%=SYS=%)
81 $(MAKE) -C src -f make/gcc.mak $@
85 # $(MAKE) -C testcode/lib $@ $(SYS:%=SYS=%)
87 uninstall: install-test
88 cd $(bindir) && $(RM) ar65${EXT} ca65${EXT} cc65${EXT} cl65${EXT} \
89 co65${EXT} da65${EXT} ld65${EXT} od65${EXT} grc${EXT} ca65html
90 $(RM) -R $(CC65DATA) $(CC65DOC)
92 install: install-test install-dirs install-bins install-libs install-docs
94 @echo 'You can export some shell environment variables:'
96 @echo 'CC65_INC=$(CC65INC)'
97 @echo 'CC65_LIB=$(CC65LIB)'
102 @if [ `id -u` != 0 ]; then \
104 echo 'If you are denied permission to install or uninstall this package,'; \
105 echo 'then you will need to do "make/gcc.mak install" or "make/gcc.mak uninstall"'; \
106 echo 'as either the root user or an administrator.'; \
112 [ -d $(bindir) ] || $(MKDIR) $(bindir)
113 [ -d $(datadir) ] || $(MKDIR) $(datadir)
114 [ -d $(docdir) ] || $(MKDIR) $(docdir)
115 [ -d $(libdir) ] || $(MKDIR) $(libdir)
116 [ -d $(CC65DOC) ] || $(MKDIR) $(CC65DOC)
117 [ -d $(CC65DATA) ] || $(MKDIR) $(CC65DATA)
118 [ -d $(CC65ASM) ] || $(MKDIR) $(CC65ASM)
119 [ -d $(CC65LIB) ] || $(MKDIR) $(CC65LIB)
120 [ -d $(CC65INC) ] || $(MKDIR) $(CC65INC)
121 [ -d $(CC65INC)/em ] || $(MKDIR) $(CC65INC)/em
122 [ -d $(CC65INC)/geos ] || $(MKDIR) $(CC65INC)/geos
123 [ -d $(CC65INC)/joystick ] || $(MKDIR) $(CC65INC)/joystick
124 [ -d $(CC65INC)/mouse ] || $(MKDIR) $(CC65INC)/mouse
125 [ -d $(CC65INC)/sys ] || $(MKDIR) $(CC65INC)/sys
126 [ -d $(CC65INC)/tgi ] || $(MKDIR) $(CC65INC)/tgi
127 [ -d $(CC65DATA)/emd ] || $(MKDIR) $(CC65DATA)/emd
128 [ -d $(CC65DATA)/joy ] || $(MKDIR) $(CC65DATA)/joy
129 [ -d $(CC65DATA)/mou ] || $(MKDIR) $(CC65DATA)/mou
130 [ -d $(CC65DATA)/ser ] || $(MKDIR) $(CC65DATA)/ser
131 [ -d $(CC65DATA)/tgi ] || $(MKDIR) $(CC65DATA)/tgi
134 for f in ar65 ca65 cc65 cl65 co65 da65 ld65 od65 grc; \
135 do $(INSTALL_STRIP) src/$$f/$$f${EXT} $(bindir) || exit 1; \
137 $(INSTALL_PROG) src/ca65html/ca65html $(bindir)
140 for f in asminc/*.inc; \
141 do $(INSTALL_DATA) $$f $(CC65ASM) || exit 1; \
143 for f in include/*.h; \
144 do $(INSTALL_DATA) $$f $(CC65INC) || exit 1; \
146 for d in em geos joystick mouse sys tgi; \
147 do for f in include/$$d/*.h; \
148 do $(INSTALL_DATA) $$f $(CC65INC)/$$d || exit 1; \
151 for f in libsrc/*.lib; \
152 do $(INSTALL_DATA) $$f $(CC65LIB) || exit 1; \
154 for d in emd joy mou ser tgi; \
155 do for f in libsrc/*.$$d; \
156 do $(INSTALL_DATA) $$f $(CC65DATA)/$$d || exit 1; \
161 for f in src/ld65/cfg/*.cfg src/ca65/macpack/*.mac; \
162 do $(INSTALL_DATA) $$f $(CC65DOC) || exit 1; \
164 for f in readme.1st compile.txt CREDITS BUGS internal.txt newvers.txt; \
165 do $(INSTALL_DATA) doc/$$f $(CC65DOC) || exit 1; \
167 if [ -f doc/index.htm* ]; \
168 then for f in doc/*.htm*; \
169 do $(INSTALL_DATA) $$f $(CC65DOC) || exit 1; \