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