5 # This makefile is maintained by Greg King <gngking@erols.com>.
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-program/-script
40 INSTALL_DATA = $(INSTALL) -c -m 644
41 INSTALL_PROG = $(INSTALL) -c -m 755
42 INSTALL_STRIP = $(INSTALL_PROG) -s
46 # The sample and library-test programs must be compiled for only one platform
47 # at a time. So, those rules are done automatically only when a user names
48 # a system on the command-line. (A user can do those rules with their
49 # defaults by putting "all samples tests" on the command-line.)
51 all: bins libs docs $(SYS:%=samples tests)
54 @$(MAKE) -C src -f make/gcc.mak
59 # A host system might not have LinuxDoc Tools, so this rule ignores errors.
63 # Some platforms cannot compile all of the sample and library-test programs.
64 # So, these rules ignore errors.
67 -@$(MAKE) -k -C samples $(SYS:%=SYS=%)
70 -@$(MAKE) -k -C testcode/lib $(SYS:%=SYS=%)
73 $(MAKE) -C src -f make/gcc.mak $@
77 $(MAKE) -C testcode/lib $@ $(SYS:%=SYS=%)
79 uninstall: install-test
80 cd $(bindir) && $(RM) ar65 ca65 cc65 cl65 co65 da65 ld65 od65 grc ca65html
81 $(RM) -R $(CC65DATA) $(CC65DOC)
83 install: install-test install-dirs install-bins install-libs install-docs
85 @echo 'You should export some shell environment variables:'
87 @echo 'CC65_INC=$(CC65INC)'
88 @echo 'CC65_LIB=$(CC65LIB)'
93 @if [ `id -u` != 0 ]; then \
95 echo 'Do "make install" or "make uninstall" as root.' >&2; \
102 -$(MKDIR) -p $(bindir) $(docdir) $(libdir)
103 -$(MKDIR) $(CC65DATA) $(CC65ASM) $(CC65DOC) $(CC65INC)
104 -$(MKDIR) $(CC65INC)/em $(CC65INC)/geos $(CC65INC)/joystick \
105 $(CC65INC)/mouse $(CC65INC)/sys $(CC65INC)/tgi
106 -$(MKDIR) $(CC65LIB) $(CC65DATA)/emd $(CC65DATA)/joy \
107 $(CC65DATA)/mou $(CC65DATA)/ser $(CC65DATA)/tgi
110 for f in ar65 ca65 cc65 cl65 co65 da65 ld65 od65 grc; \
111 do $(INSTALL_STRIP) src/$$f/$$f $(bindir) || exit 1; \
113 $(INSTALL_PROG) src/ca65html/ca65html $(bindir)
116 for f in asminc/*.inc; \
117 do $(INSTALL_DATA) $$f $(CC65ASM) || exit 1; \
119 for f in include/*.h; \
120 do $(INSTALL_DATA) $$f $(CC65INC) || exit 1; \
122 for d in em geos joystick mouse sys tgi; \
123 do for f in include/$$d/*.h; \
124 do $(INSTALL_DATA) $$f $(CC65INC)/$$d || exit 1; \
127 for f in libsrc/*.lib libsrc/*.o; \
128 do $(INSTALL_DATA) $$f $(CC65LIB) || exit 1; \
130 for d in emd joy mou ser tgi; \
131 do for f in libsrc/*.$$d; \
132 do $(INSTALL_DATA) $$f $(CC65DATA)/$$d || exit 1; \
137 for f in src/ld65/cfg/*.cfg; \
138 do $(INSTALL_DATA) $$f $(CC65DOC) || exit 1; \
140 for f in readme.1st compile.txt CREDITS BUGS internal.txt newvers.txt; \
141 do $(INSTALL_DATA) doc/$$f $(CC65DOC) || exit 1; \
143 -for f in doc/*.html; \
144 do $(INSTALL_DATA) $$f $(CC65DOC) || exit 1; \