* src/mcs51/gen.c (genEndFunction): removed unused variable to fix
[fw/sdcc] / device / lib / Makefile.in
1 #
2 #
3 #
4
5 VERSION         = @VERSION@
6 VERSIONHI       = @VERSIONHI@
7 VERSIONLO       = @VERSIONLO@
8 VERSIONP        = @VERSIONP@
9
10 SHELL           = /bin/sh
11 CPP             = @CPP@
12 INSTALL         = @INSTALL@
13 CP              = @CP@
14
15 PRJDIR          = ../..
16 INCDIR          = $(PRJDIR)/device/include
17 ifndef PORTINCDIR
18 PORTINCDIR      = $(INCDIR)/mcs51
19 endif
20
21 CC              = $(PRJDIR)/bin/sdcc
22 CPP             = $(PRJDIR)/bin/sdcpp
23
24 prefix          = @prefix@
25 exec_prefix     = @exec_prefix@
26 bindir          = @bindir@
27 libdir          = @libdir@
28 datadir         = @datadir@
29 includedir      = @includedir@
30 mandir          = @mandir@
31 man1dir         = $(mandir)/man1
32 man2dir         = $(mandir)/man2
33 infodir         = @infodir@
34 srcdir          = @srcdir@
35
36 lib_dir_suffix  = @lib_dir_suffix@
37
38 sdcc_libdir     = $(DESTDIR)$(datadir)/$(lib_dir_suffix)
39
40 CPPFLAGS        = -I$(INCDIR) -I$(PORTINCDIR)
41 CFLAGS          = $(MODELFLAGS) --nostdinc
42
43 BUILDDIR        = build
44 # Default
45 PORT            = z80
46 PORTDIR         = $(BUILDDIR)/$(PORT)
47
48 SOURCES         = _atof.c _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \
49                   _decdptr.c _divsint.c _divslong.c _divuint.c \
50                   _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
51                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
52                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fscmp.c _fsmul.c \
53                   _fsneq.c _fssub.c _gptrget.c _gptrgetc.c _gptrput.c \
54                   _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
55                   _islower.c _isprint.c _ispunct.c _isspace.c \
56                   _isupper.c _isxdigit.c _itoa.c _ltoa.c \
57                   _slong2fs.c \
58                   _memcmp.c _memcpy.c _memmove.c _memset.c \
59                   _modsint.c _modslong.c _moduint.c _modulong.c \
60                   _mulint.c _mullong.c \
61                   abs.c labs.c \
62                   _ser.c _setjmp.c \
63                   _spx.c _startup.c \
64                   _strcat.c _strchr.c _strcmp.c _strcpy.c \
65                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
66                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
67                   _strstr.c _strtok.c \
68                   _uchar2fs.c _uint2fs.c _ulong2fs.c \
69                   calloc.c malloc.c realloc.c free.c \
70                   serial.c ser_ir.c printfl.c \
71                   printf_large.c sprintf.c vprintf.c puts.c gets.c \
72                   printf_fast.c printf_fast_f.c printf_tiny.c \
73                   assert.c time.c bpx.c \
74                   _fsget1arg.c _fsget2args.c _fsnormalize.c \
75                   _fsreturnval.c _fsrshift.c _fsswapargs.c _logexpf.c \
76                   fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
77                   cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
78                   asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
79                   sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
80
81 OBJECTS         = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
82
83 Z80SOURCES      = _atof.c _atoi.c \
84                   _iscntrl.c _isdigit.c _isgraph.c \
85                   _islower.c _isprint.c _ispunct.c _isspace.c \
86                   _isupper.c _isxdigit.c \
87                   _memcmp.c _memcpy.c _memmove.c _memset.c \
88                   _startup.c \
89                   _strcat.c _strchr.c _strcmp.c _strcpy.c \
90                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
91                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
92                   _strstr.c _strtok.c \
93                   assert.c \
94                   _modslong.c _modulong.c \
95                   _mullong.c \
96                   abs.c labs.c \
97                   _divslong.c _divulong.c \
98                   calloc.c malloc.c realloc.c free.c \
99                   printf_large.c sprintf.c vprintf.c puts.c gets.c \
100                   _fs2schar.c _fs2sint.c _fs2slong.c \
101                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
102                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
103                   _fsneq.c _fssub.c \
104                   _uchar2fs.c _uint2fs.c \
105                   _ulong2fs.c \
106                   _slong2fs.c _sint2fs.c _schar2fs.c
107
108 Z80OBJECTS      = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
109
110 XA51SOURCES      = _atof.c _atoi.c _atol.c _schar2fs.c \
111                   _divsint.c _divslong.c _divuint.c \
112                   _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
113                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
114                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
115                   _fsneq.c _fssub.c \
116                   _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
117                   _islower.c _isprint.c _ispunct.c _isspace.c \
118                   _isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
119                   _memcpy.c _memmove.c _memset.c _modsint.c _modslong.c \
120                   _moduint.c _modulong.c _mulint.c _mullong.c \
121                   abs.c labs.c \
122                   _strcat.c _strchr.c _strcmp.c _strcpy.c \
123                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
124                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
125                   _strstr.c _strtok.c \
126                   _uchar2fs.c _uint2fs.c _ulong2fs.c \
127                   calloc.c malloc.c realloc.c free.c \
128                   puts.c gets.c \
129                   printf_large.c puts.c gets.c \
130                   assert.c time.c \
131                   fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
132                   cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
133                   asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
134                   sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
135
136 XA51OBJECTS      = $(XA51SOURCES:%.c=$(PORTDIR)/%.rel)
137
138 HC08SOURCES     = _atof.c _atoi.c _atol.c _schar2fs.c \
139                   _divsint.c _divslong.c \
140                   _fs2schar.c _fs2sint.c _fs2slong.c \
141                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
142                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
143                   _fsneq.c _fssub.c \
144                   _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
145                   _islower.c _isprint.c _ispunct.c _isspace.c \
146                   _isupper.c _isxdigit.c _itoa.c _ltoa.c \
147                   _slong2fs.c \
148                   _memcmp.c _memcpy.c _memmove.c _memset.c \
149                   _modsint.c _modslong.c _moduint.c _modulong.c \
150                   abs.c labs.c \
151                   _spx.c _startup.c \
152                   _strcat.c _strchr.c _strcmp.c _strcpy.c \
153                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
154                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
155                   _strstr.c _strtok.c \
156                   _uchar2fs.c _uint2fs.c _ulong2fs.c \
157                   calloc.c malloc.c realloc.c free.c \
158                   printf_large.c sprintf.c vprintf.c \
159                   assert.c time.c \
160                   fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
161                   cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
162                   asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
163                   sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
164
165 HC08OBJECTS     = $(patsubst %.c,$(PORTDIR)/%.rel,$(HC08SOURCES))
166
167 OEXT            = .rel
168
169 include incl.mk
170
171 # Compiling entire program or any subproject
172 # ------------------------------------------
173 all: checkconf models model-ds390 model-ds400 model-z80 model-gbz80 model-hc08
174
175 # model-pic16
176 # (needs gputils curently not available of sourceforge's compile farm)
177
178 objects: build-dir $(OBJECTS) port-specific-objects lib-files clean_intermediate
179
180 models:
181         if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
182           for model in $(MODELS); do \
183             $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model PORTINCDIR=$(INCDIR)/mcs51 objects; \
184           done \
185         fi
186
187 model-mcs51-stack-auto:
188         if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
189           for model in $(MODELS); do \
190             $(MAKE) MODELFLAGS="--model-$$model --stack-auto" PORT=$$model-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
191           done \
192         fi
193
194 model-mcs51-xstack-auto:
195         if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
196           for model in $(MODELS); do \
197             $(MAKE) MODELFLAGS="--model-$$model --stack-auto --xstack" PORT=$$model-xstack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
198           done \
199         fi
200
201 model-ds390:
202         if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
203           $(MAKE) MODELFLAGS="-mds390" PORT=ds390 PORTINCDIR=$(INCDIR)/mcs51 objects; \
204         fi
205
206 model-ds400:
207         if [ "`grep ds400 ../../ports.build`" = ds400 ]; then \
208           $(MAKE) MODELFLAGS="-mds400" PORT=ds400 PORTINCDIR=$(INCDIR)/mcs51 objects; \
209         fi
210
211 model-xa51:
212         if [ "`grep xa51 ../../ports.build`" = xa51 ]; then \
213           $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51; \
214         fi
215
216 objects-xa51: build-dir $(XA51OBJECTS) port-specific-objects
217         cd $(PORTDIR); ls *$(OEXT) > lib$(PORT).lib
218
219 model-z80:
220         if [ "`grep z80 ../../ports.build`" = z80 ]; then \
221           $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
222         fi
223
224 model-gbz80:
225         if [ "`grep z80 ../../ports.build`" = z80 ]; then \
226           $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
227         fi
228
229 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects clean_intermediate
230         cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
231
232 model-hc08:
233         if [ "`grep hc08 ../../ports.build`" = hc08 ]; then \
234           $(MAKE) MODELFLAGS="-mhc08" PORT=hc08 objects-hc08; \
235         fi
236
237 objects-hc08: build-dir $(HC08OBJECTS) port-specific-objects clean_intermediate
238         cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
239
240 model-pic16:
241         if [ "`grep pic16 ../../ports.build`" = pic16 ]; then \
242           $(MAKE) MODELFLAGS="-mpic16" PORT=pic16 OEXT=.lib objects-pic16; \
243           fi
244
245 objects-pic16: build-dir port-specific-objects-pic16 clean_intermediate-pic16
246         cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
247
248
249 build-dir: $(PORTDIR)
250
251 $(PORTDIR):
252         mkdir -p $(PORTDIR)
253
254 port-specific-objects:
255         if [ -d $(PORT) ]; then \
256           $(MAKE) -C $(PORT); \
257           cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
258         fi
259
260 port-specific-objects-pic16:
261         if [ -d $(PORT) ]; then \
262           $(MAKE) -C $(PORT); \
263           cp -f $(PORT)/bin/*.* $(PORTDIR); \
264         fi
265
266 lib-files:
267         cp *.lib $(PORTDIR)
268
269 clean_intermediate:
270         rm -f $(PORTDIR)/*.lst $(PORTDIR)/*.sym
271
272 clean_intermediate-pic16:
273         $(MAKE) -C $(PORT) clean-intermediate
274
275 # Compiling and installing everything and runing test
276 # ---------------------------------------------------
277 install: all installdirs
278         cp -r -u $(BUILDDIR)/* $(sdcc_libdir)
279         cp -r -u ds390 ds400 gbz80 z80 hc08 *.c $(sdcc_libdir)/src
280         rm -r `find $(sdcc_libdir)/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm' -or -name 'CVS'`
281
282 # Deleting all the installed files
283 # --------------------------------
284 uninstall:
285         rm -rf $(sdcc_libdir)
286
287 # Performing self-test
288 # --------------------
289 check:
290
291
292 # Performing installation test
293 # ----------------------------
294 installcheck:
295
296
297 # Creating installation directories
298 # ---------------------------------
299 installdirs:
300         [ -d $(sdcc_libdir) ] || mkdir -p $(sdcc_libdir)
301         for model in $(MODELS); do \
302          [ -d $(sdcc_libdir)/$$model ] || \
303          mkdir -p $(sdcc_libdir)/$$model; \
304         done
305         [ -d $(sdcc_libdir)/ds390 ] || mkdir -p $(sdcc_libdir)/ds390
306         [ -d $(sdcc_libdir)/ds400 ] || mkdir -p $(sdcc_libdir)/ds400
307         [ -d $(sdcc_libdir)/hc08 ] || mkdir -p $(sdcc_libdir)/hc08
308         [ -d $(sdcc_libdir)/pic16 ] || mkdir -p $(sdcc_libdir)/pic16
309         mkdir -p $(sdcc_libdir)/src
310
311 # Creating dependencies
312 # ---------------------
313 dep: Makefile.dep
314
315 Makefile.dep: $(SOURCES) $(INCDIR)/*.h $(PORTINCDIR)/*.h
316         rm -f Makefile.dep
317         for i in $(SOURCES); do \
318           $(CPP) -std=c99 -M $(CPPFLAGS) $$i >$${i}.dep; \
319           cat $${i}.dep >>Makefile.dep; \
320           rm $${i}.dep; \
321         done
322
323 include Makefile.dep
324 include clean.mk
325
326 # My rules
327 # --------
328
329 .SUFFIXES: .rel .o
330
331 $(PORTDIR)/%$(OEXT): %.c
332         $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
333
334 # Remaking configuration
335 # ----------------------
336 checkconf:
337         @if [ -f $(PRJDIR)/devel ]; then\
338           $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
339           freshconf;\
340         fi
341
342 # End of main_in.mk/main.mk