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