9 include $(PRJDIR)/Makefile.common
11 SDCC_MISC = debugger/mcs51 sim/ucsim
12 SDCC_LIBS = support/cpp2 support/makebin
15 # Parts that are not normally compiled but need to be cleaned
16 SDCC_EXTRA = support/regression
18 SDCC_ASLINK = as/mcs51 as link as/hc08
19 SDCC_PACKIHX = packihx
20 SDCC_LIBRARIAN = support/librarian
22 TARGETS = sdcc-libs sdcc-cc sdcc-aslink sdcc-doc
24 PKGS = $(SDCC_LIBS) src $(SDCC_ASLINK) $(SDCC_DOC)
26 ifneq ($(OPT_ENABLE_UCSIM), no)
31 ifneq ($(OPT_ENABLE_DEVICE_LIB_BUILD), no)
32 TARGETS += sdcc-device
33 PKGS += device/include device/lib
36 ifneq ($(OPT_ENABLE_PACKIHX), no)
37 TARGETS += sdcc-packihx
38 PKGS += $(SDCC_PACKIHX)
41 TARGETS += sdcc-librarian
42 PKGS += $(SDCC_LIBRARIAN)
44 PKGS_TINI = $(SDCC_LIBS) $(SDCC_ASLINK) \
45 src device/include $(SDCC_PACKIHX) $(SDCC_LIBRARIAN)
46 PORTS = $(shell cat ports.build)
47 ALLPORTS = $(shell cat ports.all)
49 # Compiling entire program or any subproject
50 # ------------------------------------------
53 tini: checkconf sdcc-tini
56 for lib in $(SDCC_LIBS); do $(MAKE) -C $$lib; done
62 for as in $(SDCC_ASLINK); do $(MAKE) -C $$as; done
65 for misc in $(SDCC_MISC); do $(MAKE) -C $$misc; done
68 $(MAKE) -C $(SDCC_PACKIHX)
71 $(MAKE) -C $(SDCC_LIBRARIAN)
73 sdcc-device: sdcc-cc sdcc-aslink
74 $(MAKE) -C device/include
78 $(MAKE) -C device/include
79 $(MAKE) -C device/lib modelDS390
81 # Empty for now, as doc depends on latex and latex2html
86 sdcc-tini: sdcc-cc sdcc-aslink sdcc-device-tini sdcc-packihx sdcc-librarian
87 $(MAKE) -f main.mk all
89 # Some interesting sub rules
90 sdcc-bin: sdcc-cc sdcc-aslink sdcc-misc
92 sdcc-base: sdcc-cc sdcc-aslink
94 # Compiling and installing everything and runing test
95 # ---------------------------------------------------
97 $(MAKE) -f main.mk install
98 @for pkg in $(PKGS); do\
99 $(MAKE) -C $$pkg install ;\
103 $(MAKE) -f main.mk install
104 @for pkg in $(PKGS_TINI); do\
105 $(MAKE) -C $$pkg install ;\
107 $(MAKE) -C device/lib installDS390
111 # Deleting all the installed files
112 # --------------------------------
114 $(MAKE) -f main.mk uninstall
115 @for pkg in $(PKGS); do\
116 $(MAKE) -C $$pkg uninstall ;\
120 # Deleting all files created by building the program
121 # --------------------------------------------------
123 @echo "+ Cleaning root of the project..."
124 $(MAKE) -f clean.mk clean
125 @echo "+ Cleaning packages in their directories..."
126 for pkg in $(PKGS); do\
127 $(MAKE) PORTS="$(PORTS)" EXEEXT=$(EXEEXT) -C $$pkg -f clean.mk clean ;\
130 # Deleting all files created by configuring or building the program
131 # -----------------------------------------------------------------
133 @echo "+ DistCleaning root of the project..."
134 $(MAKE) -f clean.mk distclean
135 @echo "+ DistCleaning packages using clean.mk..."
136 for pkg in $(PKGS); do\
137 $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) -f clean.mk distclean ;\
139 for pkg in $(SDCC_EXTRA); do \
140 $(MAKE) -C $$pkg clean; \
143 # Like clean but some files may still exist
144 # -----------------------------------------
146 $(MAKE) -f clean.mk mostlyclean
147 for pkg in $(PKGS); do\
148 $(MAKE) -C $$pkg -f clean.mk PORTS="$(PORTS)" EXEEXT=$(EXEEXT) mostlyclean ;\
152 # Deleting everything that can reconstructed by this Makefile. It deletes
153 # everything deleted by distclean plus files created by bison, stc.
154 # -----------------------------------------------------------------------
156 $(MAKE) -f clean.mk realclean
157 for pkg in $(PKGS); do\
158 $(MAKE) -C $$pkg -f clean.mk PORTS="$(PORTS)" EXEEXT=$(EXEEXT) realclean ;\
162 # Creating distribution
163 # ---------------------
165 @if [ -f devel ]; then\
166 rm -f devel; mkdist sdcc; touch devel;\
172 # Performing self-test
173 # --------------------
177 # Performing installation test
178 # ----------------------------
182 # Creating dependencies
183 # ---------------------
185 $(MAKE) -f main.mk dep
186 @for pkg in $(PKGS); do\
187 $(MAKE) -C $$pkg dep ;\
194 @if [ -f start ]; then \
196 `find . -newer start -type f -print` |\
197 gzip -9c >`date '+%m%d%H%M'`.tgz; \
199 echo "start file not found.\n"; \
204 'put(c)' -s $(STARTYEAR) *.cc *.h *.y *.l
207 # Remaking configuration
208 # ----------------------
209 configure: configure.in
212 main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in config.status
213 $(SHELL) ./config.status
217 makefiles: config.status
219 config.status: configure
220 $(SHELL) ./config.status --recheck
223 $(SHELL) ./config.status
228 @if [ -f devel ]; then\