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