Added ability to disable packihx. Removed extra echo.
[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
16 SDCC_LIBS       = support/cpp support/cpp2
17
18 SDCC_ASLINK     = as/mcs51 as link
19 SDCC_PACKIHX    = packihx
20
21 TARGETS         = sdcc-libs sdcc-cc sdcc-aslink
22
23 PKGS            = $(SDCC_LIBS) src $(SDCC_ASLINK) $(SDCC_PACKIHX)
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 sdcc: $(TARGETS)
75
76 sdcc-tini: sdcc-cc sdcc-aslink sdcc-device-tini sdcc-packihx
77         $(MAKE) -f main.mk all
78
79 # Some interesting sub rules
80 sdcc-bin: sdcc-cc sdcc-aslink sdcc-misc
81
82 sdcc-base: sdcc-cc sdcc-aslink
83
84 # Compiling and installing everything and runing test
85 # ---------------------------------------------------
86 install:
87         $(MAKE) -f main.mk install
88         @for pkg in $(PKGS); do\
89           $(MAKE) -C $$pkg install ;\
90         done
91
92 install-tini:
93         $(MAKE) -f main.mk install
94         @for pkg in $(PKGS_TINI); do\
95           $(MAKE) -C $$pkg install ;\
96         done
97         $(MAKE) -C device/lib installDS390
98
99
100
101 # Deleting all the installed files
102 # --------------------------------
103 uninstall:
104         $(MAKE) -f main.mk uninstall
105         @for pkg in $(PKGS); do\
106           $(MAKE) -C $$pkg uninstall ;\
107         done
108
109
110 # Deleting all files created by building the program
111 # --------------------------------------------------
112 clean:
113         @echo "+ Cleaning root of the project..."
114         $(MAKE) -f clean.mk clean
115         @echo "+ Cleaning packages in their directories..."
116         for pkg in $(PKGS); do\
117           $(MAKE) PORTS="$(PORTS)" -C $$pkg clean ;\
118         done
119
120
121 # Deleting all files created by configuring or building the program
122 # -----------------------------------------------------------------
123 distclean:
124         @echo "+ DistCleaning root of the project..."
125         $(MAKE) -f clean.mk distclean
126         @echo "+ DistCleaning packages using clean.mk..."
127         for pkg in $(PKGS); do\
128           $(MAKE) -C $$pkg -f clean.mk PORTS="$(PORTS)" distclean ;\
129         done
130
131
132 # Like clean but some files may still exist
133 # -----------------------------------------
134 mostlyclean: clean
135         $(MAKE) -f clean.mk mostlyclean
136         for pkg in $(PKGS); do\
137           $(MAKE) -C $$pkg -f clean.mk PORTS="$(PORTS)" mostlyclean ;\
138         done
139
140
141 # Deleting everything that can reconstructed by this Makefile. It deletes
142 # everything deleted by distclean plus files created by bison, stc.
143 # -----------------------------------------------------------------------
144 realclean: distclean
145         $(MAKE) -f clean.mk realclean
146         for pkg in $(PKGS); do\
147           $(MAKE) -C $$pkg -f clean.mk PORTS="$(PORTS)" realclean ;\
148         done
149
150
151 # Creating distribution
152 # ---------------------
153 dist: distclean
154         @if [ -f devel ]; then\
155           rm -f devel; mkdist sdcc; touch devel;\
156         else\
157           mkdist sdcc;\
158         fi
159
160
161 # Performing self-test
162 # --------------------
163 check:
164
165
166 # Performing installation test
167 # ----------------------------
168 installcheck:
169
170
171 # Creating dependencies
172 # ---------------------
173 dep:
174         $(MAKE) -f main.mk dep
175         @for pkg in $(PKGS); do\
176           $(MAKE) -C $$pkg dep ;\
177         done
178
179
180 # My rules
181 # --------
182 newer: distclean
183         @if [ -f start ]; then \
184           tar cvf - \
185             `find . -newer start -type f -print` |\
186           gzip -9c >`date '+%m%d%H%M'`.tgz; \
187         else \
188           echo "start file not found.\n"; \
189           exit 1; \
190         fi
191
192 putcopyright:
193         'put(c)' -s $(STARTYEAR) *.cc *.h *.y *.l
194
195
196 # Remaking configuration
197 # ----------------------
198 configure: configure.in
199         $(SHELL) $(AUTOCONF)
200
201 main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in config.status
202         $(SHELL) ./config.status
203
204 Makefiles: makefiles
205
206 makefiles: config.status
207
208 config.status: configure
209         $(SHELL) ./config.status --recheck
210
211 makefiles:
212         $(SHELL) ./config.status
213
214 freshconf: main.mk
215
216 checkconf:
217         @if [ -f devel ]; then\
218           $(MAKE) freshconf;\
219         fi
220
221 # End of Makefile