]> git.gag.com Git - fw/sdcc/blob - Makefile.in
* as/asranlib/asranlib.c: made it more robust
[fw/sdcc] / Makefile.in
1 #
2 #
3 #
4
5 SHELL           = /bin/sh
6
7 VPATH           = @srcdir@
8 srcdir          = @srcdir@
9 top_builddir    = @top_builddir@
10 top_srcdir      = @top_srcdir@
11
12 include Makefile.common
13
14 SDCC_LIBS       = support/makebin
15 SDCC_DOC        = doc
16
17 # Parts that are not normally compiled but need to be cleaned
18 SDCC_EXTRA      = support/regression support/valdiag
19
20 SDCC_PACKIHX    = support/packihx
21 SDCC_LIBRARIAN  = support/librarian
22 SDCC_ASRANLIB   = as/asranlib
23
24 TARGETS         = sdcc-librarian sdcc-asranlib
25
26 ifeq ($(OPT_DISABLE_HC08), 0)
27 SDCC_ASLINK     += as/hc08 as/link/hc08
28 endif
29
30 ifeq ($(OPT_DISABLE_MCS51), 0)
31 SDCC_ASLINK     += as/mcs51 as/link/mcs51
32 SDCC_MISC       += debugger/mcs51
33 endif
34
35 ifeq ($(OPT_DISABLE_Z80), 0)
36 SDCC_ASLINK     += as as/link
37 endif
38
39 ifeq ($(OPT_DISABLE_UCSIM), 0)
40 TARGETS         += sdcc-misc
41 SDCC_MISC       += sim/ucsim
42 PKGS            += $(SDCC_MISC)
43 endif
44
45 ifeq ($(OPT_DISABLE_DEVICE_LIB), 0)
46 TARGETS         += sdcc-device-lib
47 PKGS            += device/lib
48 endif
49
50 ifeq ($(OPT_DISABLE_PACKIHX), 0)
51 TARGETS         += sdcc-packihx
52 PKGS            += $(SDCC_PACKIHX)
53 endif
54
55 ifeq ($(OPT_ENABLE_DOC), 1)
56 TARGETS         += sdcc-doc
57 endif
58 # always install docs, which don't need to be built 
59 PKGS            += $(SDCC_DOC)
60
61 ifeq ($(OPT_DISABLE_SDCPP), 0)
62 SDCC_LIBS       += support/cpp
63 endif
64
65 TARGETS         += sdcc-libs sdcc-cc sdcc-device-inc sdcc-aslink
66
67 PKGS            += $(SDCC_LIBS) src device/include $(SDCC_ASLINK) $(SDCC_LIBRARIAN) $(SDCC_ASRANLIB)
68
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)
73
74 # Compiling entire program or any subproject
75 # ------------------------------------------
76 all: checkconf sdcc
77
78 tini: checkconf sdcc-tini
79
80 sdcc-libs:
81         for lib in $(SDCC_LIBS); do $(MAKE) -C $$lib; done
82
83 sdcc-cc: sdcc-libs
84         $(MAKE) -C src
85
86 sdcc-aslink:
87         for as in $(SDCC_ASLINK); do $(MAKE) -C $$as ; done
88
89 sdcc-misc:
90         for misc in $(SDCC_MISC); do $(MAKE) -C $$misc ; done
91
92 sdcc-packihx:
93         $(MAKE) -C $(SDCC_PACKIHX)
94
95 sdcc-librarian:
96         $(MAKE) -C $(SDCC_LIBRARIAN)
97
98 sdcc-asranlib:
99         $(MAKE) -C $(SDCC_ASRANLIB)
100
101 sdcc-device-inc:
102         $(MAKE) -C device/include
103
104 sdcc-device-lib: sdcc-cc sdcc-aslink
105         $(MAKE) -C device/lib
106
107 sdcc-device-tini:
108         $(MAKE) -C device/include
109         $(MAKE) -C device/lib model-ds390 model-ds400
110
111 # doc depends on latex and latex2html
112 sdcc-doc:
113         $(MAKE) -C doc
114
115 sdcc: $(TARGETS)
116
117 sdcc-tini: sdcc-librarian sdcc-asranlib sdcc-cc sdcc-aslink sdcc-device-tini sdcc-packihx
118         $(MAKE) -f main.mk all
119
120 # Some interesting sub rules
121 sdcc-bin: sdcc-cc sdcc-aslink sdcc-misc
122
123 sdcc-base: sdcc-cc sdcc-aslink
124
125 # Compiling and installing everything and runing test
126 # ---------------------------------------------------
127 install:
128         $(MAKE) -f main.mk install
129         @for pkg in $(PKGS); do\
130           $(MAKE) -C $$pkg install ;\
131         done
132
133 install-tini:
134         $(MAKE) -f main.mk install
135         @for pkg in $(PKGS_TINI); do\
136           $(MAKE) -C $$pkg install ;\
137         done
138         $(MAKE) -C device/lib install
139
140
141
142 # Deleting all the installed files
143 # --------------------------------
144 uninstall:
145         $(MAKE) -f main.mk uninstall
146         @for pkg in $(PKGS); do\
147           $(MAKE) -C $$pkg uninstall ;\
148         done
149
150
151 # Deleting all files created by building the program
152 # --------------------------------------------------
153 clean:
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 ;\
159         done
160
161 # Deleting all files created by configuring or building the program
162 # -----------------------------------------------------------------
163 distclean:
164         @echo "+ DistCleaning packages using clean.mk..."
165         for pkg in $(PKGS); do\
166           $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) distclean ;\
167         done
168         for pkg in $(SDCC_EXTRA); do \
169           $(MAKE) -C $$pkg distclean; \
170         done
171         @echo "+ DistCleaning root of the project..."
172         $(MAKE) -f $(srcdir)/clean.mk distclean
173
174 # Like clean but some files may still exist
175 # -----------------------------------------
176 mostlyclean: clean
177         $(MAKE) -f $(srcdir)/clean.mk mostlyclean
178         for pkg in $(PKGS); do\
179           $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) mostlyclean ;\
180         done
181
182
183 # Deleting everything that can reconstructed by this Makefile. It deletes
184 # everything deleted by distclean plus files created by bison, stc.
185 # -----------------------------------------------------------------------
186 realclean: distclean
187         $(MAKE) -f $(srcdir)/clean.mk realclean
188         for pkg in $(PKGS); do\
189           $(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) realclean ;\
190         done
191
192
193 # Creating distribution
194 # ---------------------
195 dist: distclean
196         @if [ -f devel ]; then\
197           rm -f devel; mkdist sdcc; touch devel;\
198         else\
199           mkdist sdcc;\
200         fi
201
202
203 # Performing self-test
204 # --------------------
205 check:
206
207
208 # Performing installation test
209 # ----------------------------
210 installcheck:
211
212
213 # Creating dependencies
214 # ---------------------
215 dep:
216         $(MAKE) -f main.mk dep
217         @for pkg in $(PKGS); do\
218           $(MAKE) -C $$pkg dep ;\
219         done
220
221
222 # My rules
223 # --------
224 newer: distclean
225         @if [ -f start ]; then \
226           tar cvf - \
227             `find . -newer start -type f -print` |\
228           gzip -9c >`date '+%m%d%H%M'`.tgz; \
229         else \
230           echo "start file not found.\n"; \
231           exit 1; \
232         fi
233
234 putcopyright:
235         'put(c)' -s $(STARTYEAR) *.cc *.h *.y *.l
236
237
238 # Remaking configuration
239 # ----------------------
240 configure: configure.in
241         $(SHELL) $(AUTOCONF)
242
243 main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in config.status
244         $(SHELL) ./config.status
245
246 Makefiles: makefiles
247
248 makefiles: config.status
249
250 config.status: configure
251         $(SHELL) ./config.status --recheck
252
253 makefiles:
254         $(SHELL) ./config.status
255
256 freshconf: main.mk
257
258 checkconf:
259         @if [ -f devel ]; then\
260           $(MAKE) freshconf;\
261         fi
262
263 # End of Makefile