055e58cb30ff7c482e70a5f00e9bbdd8f65e890b
[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 --nostdlib
39
40 BUILDDIR        = build
41 # Default
42 PORT            = z80
43 PORTDIR         = $(BUILDDIR)/$(PORT)
44
45 SOURCES         = _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 _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
69
70 OBJECTS         = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
71
72 Z80SOURCES      = _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 _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      = _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 _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
119
120 XA51OBJECTS      = $(XA51SOURCES:%.c=$(PORTDIR)/%.rel)
121
122 OEXT            = .rel
123
124 include incl.mk
125
126 # Compiling entire program or any subproject
127 # ------------------------------------------
128 all: checkconf models model-ds390 model-z80 model-gbz80
129
130 objects: build-dir $(OBJECTS) port-specific-objects lib-files clean_intermediate
131
132 models:
133         if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
134           for model in $(MODELS); do \
135             $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
136           done \
137         fi
138
139 model-ds390:
140         if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
141           $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
142         fi
143
144 model-xa51:
145         if [ "`grep xa51 ../../ports.build`" = xa51 ]; then \
146           $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51; \
147         fi
148
149 objects-xa51: build-dir $(XA51OBJECTS) port-specific-objects
150         cd $(PORTDIR); ls *$(OEXT) > lib$(PORT).lib
151
152 model-z80:
153         if [ "`grep z80 ../../ports.build`" = z80 ]; then \
154           $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
155         fi
156
157 model-gbz80:
158         if [ "`grep z80 ../../ports.build`" = z80 ]; then \
159           $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
160         fi
161
162 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects clean_intermediate
163         cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
164
165 build-dir: $(PORTDIR)
166
167 $(PORTDIR):
168         mkdir -p $(PORTDIR)
169
170 port-specific-objects:
171         if [ -d $(PORT) ]; then \
172           $(MAKE) -C $(PORT); \
173           cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
174         fi
175
176 lib-files:
177         cp *.lib $(PORTDIR)
178
179 clean_intermediate:
180         rm -f $(PORTDIR)/*.lst $(PORTDIR)/*.sym
181
182 # Compiling and installing everything and runing test
183 # ---------------------------------------------------
184 install: all installdirs
185         cp -r $(BUILDDIR)/* $(sdcc_libdir)
186         cp -r ds390 gbz80 z80 *.c $(sdcc_libdir)/src
187         rm `find $(sdcc_libdir)/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm'`
188
189 # Deleting all the installed files
190 # --------------------------------
191 uninstall:
192         rm -rf $(sdcc_libdir)
193
194 # Performing self-test
195 # --------------------
196 check:
197
198
199 # Performing installation test
200 # ----------------------------
201 installcheck:
202
203
204 # Creating installation directories
205 # ---------------------------------
206 installdirs:
207         [ -d $(sdcc_libdir) ] || mkdir -p $(sdcc_libdir)
208         for model in $(MODELS); do \
209          [ -d $(sdcc_libdir)/$$model ] || \
210          mkdir -p $(sdcc_libdir)/$$model; \
211         done
212         [ -d $(sdcc_libdir)/ds390 ] || mkdir -p $(sdcc_libdir)/ds390
213         mkdir -p $(sdcc_libdir)/src
214
215 # Creating dependencies
216 # ---------------------
217 dep: Makefile.dep
218
219 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
220         rm -f Makefile.dep
221         for i in $(SOURCES); do \
222           $(CPP) -lang-c++ -M $(CPPFLAGS) $$i >$${i}.dep; \
223           cat $${i}.dep >>Makefile.dep; \
224           rm $${i}.dep; \
225         done
226
227 include Makefile.dep
228 include clean.mk
229
230 # My rules
231 # --------
232
233 .SUFFIXES: .rel .o
234
235 $(PORTDIR)/%$(OEXT): %.c
236         $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
237
238 # Remaking configuration
239 # ----------------------
240 checkconf:
241         @if [ -f $(PRJDIR)/devel ]; then\
242           $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
243           freshconf;\
244         fi
245
246 # End of main_in.mk/main.mk