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