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 support/valdiag
20 SDCC_PACKIHX = support/packihx
21 SDCC_LIBRARIAN = support/librarian
22 SDCC_ASRANLIB = as/asranlib
24 TARGETS = sdcc-librarian sdcc-asranlib
26 ifeq ($(OPT_DISABLE_HC08), 0)
27 SDCC_ASLINK += as/hc08 as/link/hc08
30 ifeq ($(OPT_DISABLE_MCS51), 0)
31 SDCC_ASLINK += as/mcs51 as/link/mcs51
32 SDCC_MISC += debugger/mcs51
35 ifeq ($(OPT_DISABLE_Z80), 0)
36 SDCC_ASLINK += as as/link
39 ifeq ($(OPT_DISABLE_UCSIM), 0)
41 SDCC_MISC += sim/ucsim
45 ifeq ($(OPT_DISABLE_DEVICE_LIB), 0)
46 TARGETS += sdcc-device-lib
50 ifeq ($(OPT_DISABLE_PACKIHX), 0)
51 TARGETS += sdcc-packihx
52 PKGS += $(SDCC_PACKIHX)
55 ifeq ($(OPT_ENABLE_DOC), 1)
58 # always install docs, which don't need to be built
61 ifeq ($(OPT_DISABLE_SDCPP), 0)
62 SDCC_LIBS += support/cpp
65 TARGETS += sdcc-libs sdcc-cc sdcc-device-inc sdcc-aslink
67 PKGS += $(SDCC_LIBS) src device/include $(SDCC_ASLINK) $(SDCC_LIBRARIAN) $(SDCC_ASRANLIB)
69 PKGS_TINI = $(SDCC_LIBS) $(SDCC_ASLINK) \
70 src device/include $(SDCC_PACKIHX) $(SDCC_LIBRARIAN)
71 PORTS = $(shell cat ports.build)
72 ALLPORTS = $(shell cat ports.all)
74 # Compiling entire program or any subproject
75 # ------------------------------------------
78 tini: checkconf sdcc-tini
81 for lib in $(SDCC_LIBS); do $(MAKE) -C $$lib; done
87 for as in $(SDCC_ASLINK); do $(MAKE) -C $$as ; done
90 for misc in $(SDCC_MISC); do $(MAKE) -C $$misc ; done
93 $(MAKE) -C $(SDCC_PACKIHX)
96 $(MAKE) -C $(SDCC_LIBRARIAN)
99 $(MAKE) -C $(SDCC_ASRANLIB)
102 $(MAKE) -C device/include
104 sdcc-device-lib: sdcc-cc sdcc-aslink
105 $(MAKE) -C device/lib
108 $(MAKE) -C device/include
109 $(MAKE) -C device/lib model-ds390 model-ds400
111 # doc depends on latex and latex2html
117 sdcc-tini: sdcc-librarian sdcc-asranlib sdcc-cc sdcc-aslink sdcc-device-tini sdcc-packihx
118 $(MAKE) -f main.mk all
120 # Some interesting sub rules
121 sdcc-bin: sdcc-cc sdcc-aslink sdcc-misc
123 sdcc-base: sdcc-cc sdcc-aslink
125 # Compiling and installing everything and runing test
126 # ---------------------------------------------------
128 $(MAKE) -f main.mk install
129 @for pkg in $(PKGS); do\
130 $(MAKE) -C $$pkg install ;\
134 $(MAKE) -f main.mk install
135 @for pkg in $(PKGS_TINI); do\
136 $(MAKE) -C $$pkg install ;\
138 $(MAKE) -C device/lib install
142 # Deleting all the installed files
143 # --------------------------------
145 $(MAKE) -f main.mk uninstall
146 @for pkg in $(PKGS); do\
147 $(MAKE) -C $$pkg uninstall ;\
151 # Deleting all files created by building the program
152 # --------------------------------------------------
154 @echo "+ Cleaning root of the project..."
155 $(MAKE) -f $(srcdir)/clean.mk clean
156 @echo "+ Cleaning packages in their directories..."
157 for pkg in $(PKGS); do\
158 $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) clean ;\
161 # Deleting all files created by configuring or building the program
162 # -----------------------------------------------------------------
164 @echo "+ DistCleaning packages using clean.mk..."
165 for pkg in $(PKGS); do\
166 $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) distclean ;\
168 for pkg in $(SDCC_EXTRA); do \
169 $(MAKE) -C $$pkg distclean; \
171 @echo "+ DistCleaning root of the project..."
172 $(MAKE) -f $(srcdir)/clean.mk distclean
174 # Like clean but some files may still exist
175 # -----------------------------------------
177 $(MAKE) -f $(srcdir)/clean.mk mostlyclean
178 for pkg in $(PKGS); do\
179 $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) mostlyclean ;\
183 # Deleting everything that can reconstructed by this Makefile. It deletes
184 # everything deleted by distclean plus files created by bison, stc.
185 # -----------------------------------------------------------------------
187 $(MAKE) -f $(srcdir)/clean.mk realclean
188 for pkg in $(PKGS); do\
189 $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) realclean ;\
193 # Creating distribution
194 # ---------------------
196 @if [ -f devel ]; then\
197 rm -f devel; mkdist sdcc; touch devel;\
203 # Performing self-test
204 # --------------------
208 # Performing installation test
209 # ----------------------------
213 # Creating dependencies
214 # ---------------------
216 $(MAKE) -f main.mk dep
217 @for pkg in $(PKGS); do\
218 $(MAKE) -C $$pkg dep ;\
225 @if [ -f start ]; then \
227 `find . -newer start -type f -print` |\
228 gzip -9c >`date '+%m%d%H%M'`.tgz; \
230 echo "start file not found.\n"; \
235 'put(c)' -s $(STARTYEAR) *.cc *.h *.y *.l
238 # Remaking configuration
239 # ----------------------
240 configure: configure.in
243 main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in config.status
244 $(SHELL) ./config.status
248 makefiles: config.status
250 config.status: configure
251 $(SHELL) ./config.status --recheck
254 $(SHELL) ./config.status
259 @if [ -f devel ]; then\