9 top_builddir = @top_builddir@
10 top_srcdir = @top_srcdir@
12 include Makefile.common
14 SDCC_LIBS = support/makebin
17 # Parts that are not normally compiled but need to be cleaned
18 SDCC_EXTRA = support/regression
20 SDCC_PACKIHX = support/packihx
21 SDCC_LIBRARIAN = support/librarian
23 ifeq ($(OPT_DISABLE_HC08), 0)
24 SDCC_ASLINK += as/hc08 as/link/hc08
27 ifeq ($(OPT_DISABLE_MCS51), 0)
28 SDCC_ASLINK += as/mcs51 as/link/mcs51
29 SDCC_MISC += debugger/mcs51
32 ifeq ($(OPT_DISABLE_Z80), 0)
33 SDCC_ASLINK += as as/link
36 ifeq ($(OPT_DISABLE_UCSIM), 0)
38 SDCC_MISC += sim/ucsim
42 ifeq ($(OPT_DISABLE_DEVICE_LIB), 0)
43 TARGETS += sdcc-device-lib
47 ifeq ($(OPT_DISABLE_PACKIHX), 0)
48 TARGETS += sdcc-packihx
49 PKGS += $(SDCC_PACKIHX)
52 ifeq ($(OPT_ENABLE_DOC), 1)
55 # always install docs, which don't need to be built
58 ifeq ($(OPT_DISABLE_SDCPP), 0)
59 SDCC_LIBS += support/cpp2
62 TARGETS += sdcc-libs sdcc-cc sdcc-device-inc sdcc-aslink sdcc-librarian
64 PKGS += $(SDCC_LIBS) src device/include $(SDCC_ASLINK) $(SDCC_LIBRARIAN)
66 PKGS_TINI = $(SDCC_LIBS) $(SDCC_ASLINK) \
67 src device/include $(SDCC_PACKIHX) $(SDCC_LIBRARIAN)
68 PORTS = $(shell cat ports.build)
69 ALLPORTS = $(shell cat ports.all)
71 # Compiling entire program or any subproject
72 # ------------------------------------------
75 tini: checkconf sdcc-tini
78 for lib in $(SDCC_LIBS); do $(MAKE) -C $$lib; done
84 for as in $(SDCC_ASLINK); do $(MAKE) -C $$as ; done
87 for misc in $(SDCC_MISC); do $(MAKE) -C $$misc ; done
90 $(MAKE) -C $(SDCC_PACKIHX)
93 $(MAKE) -C $(SDCC_LIBRARIAN)
96 $(MAKE) -C device/include
98 sdcc-device-lib: sdcc-cc sdcc-aslink
102 $(MAKE) -C device/include
103 $(MAKE) -C device/lib modelDS390
105 # doc depends on latex and latex2html
111 sdcc-tini: sdcc-cc sdcc-aslink sdcc-device-tini sdcc-packihx sdcc-librarian
112 $(MAKE) -f main.mk all
114 # Some interesting sub rules
115 sdcc-bin: sdcc-cc sdcc-aslink sdcc-misc
117 sdcc-base: sdcc-cc sdcc-aslink
119 # Compiling and installing everything and runing test
120 # ---------------------------------------------------
122 $(MAKE) -f main.mk install
123 @for pkg in $(PKGS); do\
124 $(MAKE) -C $$pkg install ;\
128 $(MAKE) -f main.mk install
129 @for pkg in $(PKGS_TINI); do\
130 $(MAKE) -C $$pkg install ;\
132 $(MAKE) -C device/lib installDS390
136 # Deleting all the installed files
137 # --------------------------------
139 $(MAKE) -f main.mk uninstall
140 @for pkg in $(PKGS); do\
141 $(MAKE) -C $$pkg uninstall ;\
145 # Deleting all files created by building the program
146 # --------------------------------------------------
148 @echo "+ Cleaning root of the project..."
149 $(MAKE) -f $(srcdir)/clean.mk clean
150 @echo "+ Cleaning packages in their directories..."
151 for pkg in $(PKGS); do\
152 $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) clean ;\
155 # Deleting all files created by configuring or building the program
156 # -----------------------------------------------------------------
158 @echo "+ DistCleaning packages using clean.mk..."
159 for pkg in $(PKGS); do\
160 $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) distclean ;\
162 for pkg in $(SDCC_EXTRA); do \
163 $(MAKE) -C $$pkg distclean; \
165 @echo "+ DistCleaning root of the project..."
166 $(MAKE) -f $(srcdir)/clean.mk distclean
168 # Like clean but some files may still exist
169 # -----------------------------------------
171 $(MAKE) -f $(srcdir)/clean.mk mostlyclean
172 for pkg in $(PKGS); do\
173 $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) mostlyclean ;\
177 # Deleting everything that can reconstructed by this Makefile. It deletes
178 # everything deleted by distclean plus files created by bison, stc.
179 # -----------------------------------------------------------------------
181 $(MAKE) -f $(srcdir)/clean.mk realclean
182 for pkg in $(PKGS); do\
183 $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) realclean ;\
187 # Creating distribution
188 # ---------------------
190 @if [ -f devel ]; then\
191 rm -f devel; mkdist sdcc; touch devel;\
197 # Performing self-test
198 # --------------------
202 # Performing installation test
203 # ----------------------------
207 # Creating dependencies
208 # ---------------------
210 $(MAKE) -f main.mk dep
211 @for pkg in $(PKGS); do\
212 $(MAKE) -C $$pkg dep ;\
219 @if [ -f start ]; then \
221 `find . -newer start -type f -print` |\
222 gzip -9c >`date '+%m%d%H%M'`.tgz; \
224 echo "start file not found.\n"; \
229 'put(c)' -s $(STARTYEAR) *.cc *.h *.y *.l
232 # Remaking configuration
233 # ----------------------
234 configure: configure.in
237 main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in config.status
238 $(SHELL) ./config.status
242 makefiles: config.status
244 config.status: configure
245 $(SHELL) ./config.status --recheck
248 $(SHELL) ./config.status
253 @if [ -f devel ]; then\