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