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