2 # sdcc project main Makefile
9 top_builddir
= @top_builddir@
10 top_srcdir
= @top_srcdir@
14 include Makefile.common
16 SDCC_LIBS
= support
/makebin
17 SDCC_SCRIPTS
= support
/scripts
20 # Parts that are not normally compiled but need to be cleaned
21 SDCC_EXTRA
= support
/regression support
/valdiag
23 SDCC_PACKIHX
= support
/packihx
24 SDCC_SDBINUTILS
= support
/sdbinutils
26 ifneq ($(OPT_DISABLE_HC08
)$(OPT_DISABLE_S08
), 11)
27 SDCC_AS
+= sdas
/as6808
28 SDCC_LD
+= sdcc-ld6808
31 ifneq ($(OPT_DISABLE_MOS6502
)$(OPT_DISABLE_MOS65C02
), 11)
32 SDCC_AS
+= sdas
/as6500
33 SDCC_LD
+= sdcc-ld6808
36 ifeq ($(OPT_DISABLE_STM8
), 0)
37 SDCC_AS
+= sdas
/asstm8
38 SDCC_LD
+= sdcc-ldstm8
41 ifneq ($(OPT_DISABLE_DS390
)$(OPT_DISABLE_DS400
), 11)
42 SDCC_AS
+= sdas
/as8xcxxx
45 ifeq ($(OPT_DISABLE_MCS51
), 0)
46 SDCC_AS
+= sdas
/as8051
47 SDCC_LD
+= sdcc-ld8051
48 SDCC_MISC
+= debugger
/mcs51
51 ifneq ($(OPT_DISABLE_Z80
)$(OPT_DISABLE_Z180
)$(OPT_DISABLE_Z80N
)$(OPT_DISABLE_R800
), 1111)
56 ifneq ($(OPT_DISABLE_R2K
)$(OPT_DISABLE_R2KA
)$(OPT_DISABLE_R3KA
), 111)
61 ifeq ($(OPT_DISABLE_TLCS90
), 0)
62 SDCC_AS
+= sdas
/astlcs90
65 ifeq ($(OPT_DISABLE_SM83
), 0)
70 ifeq ($(OPT_DISABLE_PDK13
), 0)
71 SDCC_AS
+= sdas
/aspdk13
75 ifeq ($(OPT_DISABLE_PDK14
), 0)
76 SDCC_AS
+= sdas
/aspdk14
80 ifeq ($(OPT_DISABLE_PDK15
), 0)
81 SDCC_AS
+= sdas
/aspdk15
85 ifeq ($(OPT_DISABLE_PDK16
), 0)
86 SDCC_AS
+= sdas
/aspdk16
90 ifeq ($(OPT_DISABLE_F8
), 0)
96 ifeq ($(OPT_DISABLE_UCSIM
), 0)
98 SDCC_MISC
+= sim
/ucsim
103 ifeq ($(OPT_DISABLE_SDBINUTILS
), 0)
104 TARGETS
+= sdcc-sdbinutils
105 PKGS
+= $(SDCC_SDBINUTILS
)
106 SDCC_BINUTILS
= sdcc-sdbinutils
109 ifeq ($(OPT_DISABLE_DEVICE_LIB
), 0)
110 TARGETS
+= sdcc-device-lib
112 ifeq ($(OPT_DISABLE_NON_FREE
), 0)
113 PKGS
+= device
/non-free
/lib
117 ifeq ($(OPT_DISABLE_PACKIHX
), 0)
118 TARGETS
+= sdcc-packihx
119 PKGS
+= $(SDCC_PACKIHX
)
122 ifeq ($(OPT_ENABLE_DOC
), 1)
125 # always install docs, which don't need to be built
128 ifeq ($(OPT_DISABLE_SDCPP
), 0)
129 SDCC_LIBS
+= support
/cpp
132 TARGETS
+= sdcc-libs sdcc-cc sdcc-device-inc sdcc-as sdcc-ld sdcc-scripts
134 PKGS
+= $(SDCC_LIBS
) src device
/include
135 ifeq ($(OPT_DISABLE_NON_FREE
), 0)
136 PKGS
+= device
/non-free
/include
138 PKGS
+= $(SDCC_AS
) sdas
/linksrc
$(SDCC_SCRIPTS
)
140 PORTS
= $(shell cat ports.build
)
141 ALLPORTS
= $(shell cat ports.
all)
143 # Compiling entire program or any subproject
144 # ------------------------------------------
147 tini
: checkconf sdcc-tini
149 sdcc-libs
: ${SDCC_BINUTILS}
150 for lib in
$(SDCC_LIBS
); do
$(MAKE
) -C
$$lib; done
156 $(foreach as, $(SDCC_AS
), $(MAKE
) -C
$(as) &&) echo
"Assemblers built successfully."
159 $(MAKE
) -C sdas
/linksrc
$(SDCC_LD
)
162 for misc in
$(SDCC_MISC
); do
$(MAKE
) -C
$$misc ; done
165 $(MAKE
) -C
$(SDCC_SCRIPTS
)
168 $(MAKE
) -C
$(SDCC_PACKIHX
)
171 $(MAKE
) -C
$(SDCC_SDBINUTILS
)
174 $(MAKE
) -C device
/include
175 ifeq ($(OPT_DISABLE_NON_FREE
), 0)
176 $(MAKE
) -C device
/non-free
/include
179 sdcc-device-lib
: sdcc-cc sdcc-as sdcc-ld
$(SDCC_BINUTILS
)
180 $(MAKE
) -C device
/lib
181 ifeq ($(OPT_DISABLE_NON_FREE
), 0)
182 $(MAKE
) -C device
/non-free
/lib
186 $(MAKE
) -C device
/include
187 ifeq ($(OPT_DISABLE_NON_FREE
), 0)
188 $(MAKE
) -C device
/non-free
/include
190 $(MAKE
) -C device
/lib model-ds390 model-ds400
192 # doc depends on latex and latex2html
198 sdcc-tini
: sdcc-cc sdcc-as sdcc-ld sdcc-device-tini sdcc-packihx
199 $(MAKE
) -f main.mk
all
201 # Some interesting sub rules
202 sdcc-bin
: sdcc-cc sdcc-as sdcc-ld sdcc-misc
204 sdcc-base
: sdcc-cc sdcc-as sdcc-ld
206 # Compiling and installing everything and running test
207 # ----------------------------------------------------
208 install: checkconf sdcc
209 $(MAKE
) -f main.mk
install
210 @for pkg in
$(PKGS
); do\
211 $(MAKE
) -C
$$pkg install ;\
214 # Deleting all the installed files
215 # --------------------------------
217 $(MAKE
) -f main.mk
uninstall
218 @for pkg in
$(PKGS
); do\
219 $(MAKE
) -C
$$pkg uninstall ;\
222 # Deleting all files created by building the program
223 # --------------------------------------------------
225 @echo
"+ Cleaning root of the project..."
226 $(MAKE
) -f
$(srcdir)/clean.mk
clean
227 @echo
"+ Cleaning packages in their directories..."
228 for pkg in
$(PKGS
); do\
229 $(MAKE
) -C
$$pkg PORTS
="$(PORTS)" EXEEXT
=$(EXEEXT
) clean ;\
232 # Deleting all files created by configuring or building the program
233 # -----------------------------------------------------------------
235 @echo
"+ DistCleaning packages using clean.mk..."
236 for pkg in
$(PKGS
); do\
237 $(MAKE
) -C
$$pkg PORTS
="$(PORTS)" EXEEXT
=$(EXEEXT
) distclean ;\
239 for pkg in
$(SDCC_EXTRA
); do \
240 $(MAKE
) -C
$$pkg distclean; \
242 @echo
"+ DistCleaning root of the project..."
243 $(MAKE
) -f
$(srcdir)/clean.mk
distclean
245 # Like clean but some files may still exist
246 # -----------------------------------------
248 $(MAKE
) -f
$(srcdir)/clean.mk
mostlyclean
249 for pkg in
$(PKGS
); do\
250 $(MAKE
) -C
$$pkg PORTS
="$(PORTS)" EXEEXT
=$(EXEEXT
) mostlyclean ;\
253 # Deleting everything that can reconstructed by this Makefile. It deletes
254 # everything deleted by distclean plus files created by bison, stc.
255 # -----------------------------------------------------------------------
257 $(MAKE
) -f
$(srcdir)/clean.mk
realclean
258 for pkg in
$(PKGS
); do\
259 $(MAKE
) -C
$$pkg PORTS
="$(PORTS)" EXEEXT
=$(EXEEXT
) realclean ;\
262 # Performing self-test
263 # --------------------
266 # Performing installation test
267 # ----------------------------
270 # Creating dependencies
271 # ---------------------
273 $(MAKE
) -f main.mk dep
274 @for pkg in
$(PKGS
); do\
275 $(MAKE
) -C
$$pkg dep
;\
281 @if
[ -f start
]; then \
283 `find . -newer start -type f -print` |\
284 gzip
-9c
>`date '+%m%d%H%M'`.tgz
; \
286 echo
"start file not found.\n"; \
291 'put(c)' -s
$(STARTYEAR
) *.
cc *.h
*.y
*.l
293 # Remaking configuration
294 # ----------------------
295 configure
: configure.in
298 main.mk
: $(srcdir)/main_in.mk
$(srcdir)/configure.in config.status
299 $(SHELL
) .
/config.status
303 makefiles
: config.status
305 config.status
: configure
306 $(SHELL
) .
/config.status
--recheck
309 $(SHELL
) .
/config.status
314 @if
[ -f devel
]; then\
320 Makefile
: $(srcdir)/Makefile.in
321 cd
$(top_builddir
); .
/config.status Makefile
323 Makefile.common
: $(srcdir)/Makefile.common.in
324 cd
$(top_builddir
); .
/config.status Makefile.common