* src/SDCCmain.c (assemble, linkEdit): preparations for -o
[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 sdcc_datadir    = @sdcc_datadir@
27 includedir      = @includedir@
28 mandir          = @mandir@
29 man1dir         = $(mandir)/man1
30 man2dir         = $(mandir)/man2
31 infodir         = @infodir@
32 srcdir          = @srcdir@
33
34 CPPFLAGS        = -I$(INCDIR)
35 CFLAGS          = $(MODELFLAGS) --nostdinc --nostdlib
36
37 BUILDDIR        = build
38 # Default
39 PORT            = z80
40 PORTDIR         = $(BUILDDIR)/$(PORT)
41
42 SOURCES         = _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \
43                   _decdptr.c _divsint.c _divslong.c _divuint.c \
44                   _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
45                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
46                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
47                   _fsneq.c _fssub.c _gptrget.c _gptrgetc.c _gptrput.c \
48                   _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
49                   _islower.c _isprint.c _ispunct.c _isspace.c \
50                   _isupper.c _isxdigit.c _itoa.c _ltoa.c \
51                   _slong2fs.c _memcmp.c \
52                   _memcpy.c _memset.c _modsint.c _modslong.c \
53                   _moduint.c _modulong.c _mulint.c _mullong.c \
54                   _ser.c _setjmp.c \
55                   _spx.c _startup.c _strchr.c _strcmp.c _strcpy.c \
56                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
57                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
58                   _strstr.c _strtok.c _uchar2fs.c _uint2fs.c \
59                   _ulong2fs.c malloc.c serial.c ser_ir.c printfl.c \
60                   printf_large.c vprintf.c puts.c gets.c \
61                   assert.c _strcat.c time.c printf_fast.c bpx.c \
62                   fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
63                   cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
64                   asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
65                   sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c
66
67 OBJECTS         = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
68
69 Z80SOURCES      = _atoi.c \
70                   _iscntrl.c _isdigit.c _isgraph.c \
71                   _islower.c _isprint.c _ispunct.c _isspace.c \
72                   _isupper.c _isxdigit.c _memcmp.c \
73                   _memcpy.c _memset.c \
74                   _startup.c _strchr.c _strcmp.c _strcpy.c \
75                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
76                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
77                   _strstr.c _strtok.c \
78                   puts.c gets.c \
79                   assert.c _strcat.c \
80                   _modslong.c _modulong.c \
81                   _mullong.c \
82                   _divslong.c _divulong.c \
83                   malloc.c \
84                   _fs2schar.c _fs2sint.c _fs2slong.c \
85                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
86                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
87                   _fsneq.c _fssub.c \
88                   _uchar2fs.c _uint2fs.c \
89                   _ulong2fs.c \
90                   _slong2fs.c _sint2fs.c _schar2fs.c 
91
92 Z80OBJECTS      = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
93
94 XA51SOURCES      = _atoi.c _atol.c _schar2fs.c \
95                   _divsint.c _divslong.c _divuint.c \
96                   _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
97                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
98                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
99                   _fsneq.c _fssub.c \
100                   _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
101                   _islower.c _isprint.c _ispunct.c _isspace.c \
102                   _isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
103                   _memcpy.c _memset.c _modsint.c _modslong.c \
104                   _moduint.c _modulong.c _mulint.c _mullong.c \
105                   _strchr.c _strcmp.c _strcpy.c \
106                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
107                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
108                   _strstr.c _strtok.c _uchar2fs.c _uint2fs.c \
109                   _ulong2fs.c malloc.c puts.c gets.c \
110                   printf_large.c puts.c gets.c \
111                   assert.c _strcat.c time.c \
112                   fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
113                   cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
114                   asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
115                   sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c
116
117 XA51OBJECTS      = $(XA51SOURCES:%.c=$(PORTDIR)/%.rel)
118
119 OEXT            = .rel
120
121 include incl.mk
122
123 # Compiling entire program or any subproject
124 # ------------------------------------------
125 all: checkconf models model-ds390 model-z80 model-gbz80
126
127 objects: build-dir $(OBJECTS) port-specific-objects lib-files clean_intermediate
128
129 models:
130         if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
131           for model in $(MODELS); do \
132             $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
133           done \
134         fi
135
136 model-ds390:
137         if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
138           $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
139         fi
140
141 model-xa51:
142         if [ "`grep xa51 ../../ports.build`" = xa51 ]; then \
143           $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51; \
144         fi
145
146 objects-xa51: build-dir $(XA51OBJECTS) port-specific-objects
147         cd $(PORTDIR); ls *$(OEXT) > lib$(PORT).lib
148
149 model-z80:
150         if [ "`grep z80 ../../ports.build`" = z80 ]; then \
151           $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
152         fi
153
154 model-gbz80:
155         if [ "`grep z80 ../../ports.build`" = z80 ]; then \
156           $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
157         fi
158
159 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects clean_intermediate
160         cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
161
162 build-dir: $(PORTDIR)
163
164 $(PORTDIR):
165         mkdir -p $(PORTDIR)
166
167 port-specific-objects:
168         if [ -d $(PORT) ]; then \
169           $(MAKE) -C $(PORT); \
170           cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
171         fi
172
173 lib-files:
174         cp *.lib $(PORTDIR)
175
176 clean_intermediate:
177         rm -f $(PORTDIR)/*.lst $(PORTDIR)/*.sym
178
179 # Compiling and installing everything and runing test
180 # ---------------------------------------------------
181 install: all installdirs
182         cp -r $(BUILDDIR)/* $(sdcc_datadir)/lib
183         cp -r ds390 gbz80 z80 *.c $(sdcc_datadir)/lib/src
184         rm `find $(sdcc_datadir)/lib/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm'`
185
186 # Deleting all the installed files
187 # --------------------------------
188 uninstall:
189         for hdr in ../include/*.h; do rm -f $(sdcc_datadir)/include/$$hdr; done
190         for cfl in *.c; do rm -f $(sdcc_datadir)/lib/$$cfl; done
191         for model in $(MODELS); do \
192           rm -rf $(sdcc_datadir)/lib/$$model; \
193         done
194         rm -rf $(sdcc_datadir)/lib/ds390
195
196
197 # Performing self-test
198 # --------------------
199 check:
200
201
202 # Performing installation test
203 # ----------------------------
204 installcheck:
205
206
207 # Creating installation directories
208 # ---------------------------------
209 installdirs:
210         [ -d $(sdcc_datadir)/lib ] || mkdir -p $(sdcc_datadir)/lib
211         for model in $(MODELS); do \
212          [ -d $(sdcc_datadir)/lib/$$model ] || \
213          mkdir -p $(sdcc_datadir)/lib/$$model; \
214         done
215         [ -d $(sdcc_datadir)/lib/ds390 ] || mkdir -p $(sdcc_datadir)/lib/ds390
216         mkdir -p $(sdcc_datadir)/lib/src
217
218 # Creating dependencies
219 # ---------------------
220 dep: Makefile.dep
221
222 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
223         rm -f Makefile.dep
224         for i in $(SOURCES); do \
225           $(CPP) -lang-c++ -M $(CPPFLAGS) $$i >$${i}.dep; \
226           cat $${i}.dep >>Makefile.dep; \
227           rm $${i}.dep; \
228         done
229
230 include Makefile.dep
231 include clean.mk
232
233 # My rules
234 # --------
235
236 .SUFFIXES: .rel .o
237
238 $(PORTDIR)/%$(OEXT): %.c
239         $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
240
241 # Remaking configuration
242 # ----------------------
243 checkconf:
244         @if [ -f $(PRJDIR)/devel ]; then\
245           $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
246           freshconf;\
247         fi
248
249 # End of main_in.mk/main.mk