History

added configure - gcc 3.x support

bellard committed 23 years ago

Commit cb960221 parent f46a02a1 file · +42 −31Browse files

Unified · Split

Makefile+42−31
@@ -1,24 +1,30 @@
11 #
22 # Tiny C Compiler Makefile
33 #
4−prefix=/usr/local
5−manpath=$(prefix)/man
4+include config.mak
65
76 CFLAGS=-O2 -g -Wall
87 LIBS=-ldl
98 CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
109 LIBS_P=
1110
12−CFLAGS+=-m386 -malign-functions=0 -mpreferred-stack-boundary=2
13−CFLAGS+=-DCONFIG_TCC_PREFIX=\"$(prefix)\"
11+CFLAGS+=-mpreferred-stack-boundary=2
12+ifeq ($(GCC_MAJOR),2)
13+CFLAGS+=-m386 -malign-functions=0
14+else
15+CFLAGS+=-march=i386 -falign-functions=0
16+endif
17+
18+
1419 DISAS=objdump -d
1520 INSTALL=install
16−VERSION=0.9.16
1721
1822 # run local version of tcc with local libraries and includes
1923 TCC=./tcc -B. -I.
2024
21−all: tcc libtcc1.o bcheck.o tcc-doc.html
25+all: tcc libtcc1.o bcheck.o tcc-doc.html libtcc.a libtcc_test
26+
27+Makefile: config.mak
2228
2329 # auto test
2430
@@ -26,7 +32,7 @@ test: test.ref test.out · 1 unmodified line
2632 @if diff -u test.ref test.out ; then echo "Auto Test OK"; fi
2733
2834 tcctest.ref: tcctest.c
29− gcc $(CFLAGS) -I. -o $@ $<
35+ $(CC) $(CFLAGS) -I. -o $@ $<
3036
3137 test.ref: tcctest.ref
3238 ./tcctest.ref > $@
@@ -96,41 +102,46 @@ speed: tcc ex2 ex3 · 63 unmodified lines
96102 time ./tcc -I. ./ex3.c 35
97103
98104 ex2: ex2.c
99− gcc $(CFLAGS) -o $@ $<
105+ $(CC) $(CFLAGS) -o $@ $<
100106
101107 ex3: ex3.c
102− gcc $(CFLAGS) -o $@ $<
108+ $(CC) $(CFLAGS) -o $@ $<
103109
104110 # Native Tiny C Compiler
105111
106112 tcc_g: tcc.c i386-gen.c tccelf.c tccasm.c i386-asm.c tcctok.h libtcc.h i386-asm.h Makefile
107− gcc $(CFLAGS) -o $@ $< $(LIBS)
113+ $(CC) $(CFLAGS) -o $@ $< $(LIBS)
108114
109−tcc: tcc_g
115+tcc: tcc_g Makefile
110116 strip -s -R .comment -R .note -o $@ $<
111117
112118 # TinyCC runtime libraries
113119 libtcc1.o: libtcc1.c
114− gcc -O2 -Wall -c -o $@ $<
120+ $(CC) -O2 -Wall -c -o $@ $<
115121
116122 bcheck.o: bcheck.c
117− gcc -O2 -Wall -c -o $@ $<
118−
119−install: tcc libtcc1.o bcheck.o
120− $(INSTALL) -m755 tcc $(prefix)/bin
121− $(INSTALL) tcc.1 $(manpath)/man1
122− mkdir -p $(prefix)/lib/tcc
123− mkdir -p $(prefix)/lib/tcc/include
124− $(INSTALL) -m644 libtcc1.o bcheck.o $(prefix)/lib/tcc
123+ $(CC) -O2 -Wall -c -o $@ $<
124+
125+install: tcc_install libinstall
126+
127+tcc_install: tcc libtcc1.o bcheck.o
128+ $(INSTALL) -m755 tcc $(bindir)
129+ $(INSTALL) tcc.1 $(mandir)/man1
130+ mkdir -p $(libdir)/tcc
131+ mkdir -p $(libdir)/tcc/include
132+ $(INSTALL) -m644 libtcc1.o bcheck.o $(libdir)/tcc
125133 $(INSTALL) -m644 stdarg.h stddef.h stdbool.h float.h varargs.h \
126− tcclib.h $(prefix)/lib/tcc/include
134+ tcclib.h $(libdir)/tcc/include
127135
128136 clean:
129137 rm -f *~ *.o tcc tcc1 tcct tcc_g tcctest.ref *.bin *.i ex2 \
130138 core gmon.out test.out test.ref a.out tcc_p \
131− *.exe tcc-doc.html \
139+ *.exe tcc-doc.html libtcc.a libtcc_test \
132140 tcctest[1234] test[1234].out
133141
142+distclean: clean
143+ rm -f config.h config.mak
144+
134145 # win32 TCC
135146 tcc_g.exe: tcc.c i386-gen.c bcheck.c Makefile
136147 i386-mingw32msvc-gcc $(CFLAGS) -DCONFIG_TCC_STATIC -o $@ $<
@@ -140,21 +151,21 @@ tcc.exe: tcc_g.exe · 3 unmodified lines
140151
141152 # profiling version
142153 tcc_p: tcc.c Makefile
143− gcc $(CFLAGS_P) -o $@ $< $(LIBS_P)
154+ $(CC) $(CFLAGS_P) -o $@ $< $(LIBS_P)
144155
145156 # libtcc generation and example
146157 libinstall: libtcc.a
147− $(INSTALL) -m644 libtcc.a $(prefix)/lib
148− $(INSTALL) -m644 libtcc.h $(prefix)/include
158+ $(INSTALL) -m644 libtcc.a $(libdir)
159+ $(INSTALL) -m644 libtcc.h $(includedir)
149160
150161 libtcc.o: tcc.c i386-gen.c bcheck.c Makefile
151− gcc $(CFLAGS) -DLIBTCC -c -o $@ $<
162+ $(CC) $(CFLAGS) -DLIBTCC -c -o $@ $<
152163
153164 libtcc.a: libtcc.o
154− ar rcs $@ $^
165+ $(AR) rcs $@ $^
155166
156167 libtcc_test: libtcc_test.c libtcc.a
157− gcc $(CFLAGS) -I. -o $@ $< -L. -ltcc -ldl
168+ $(CC) $(CFLAGS) -I. -o $@ $< -L. -ltcc -ldl
158169
159170 libtest: libtcc_test
160171 ./libtcc_test
@@ -171,7 +182,7 @@ instr: instr.o · 10 unmodified lines
171182 # tiny assembler testing
172183
173184 asmtest.ref: asmtest.S
174− gcc -c -o asmtest.ref.o asmtest.S
185+ $(CC) -c -o asmtest.ref.o asmtest.S
175186 objdump -D asmtest.ref.o > $@
176187
177188 # XXX: we compute tcc.c to go faster during development !
@@ -185,7 +196,7 @@ asmtest: asmtest.out asmtest.ref · 7 unmodified lines
185196 @if diff -u --ignore-matching-lines="file format" asmtest.ref asmtest.out ; then echo "ASM Auto Test OK"; fi
186197
187198 instr.o: instr.S
188− gcc -O2 -Wall -g -c -o $@ $<
199+ $(CC) -O2 -Wall -g -c -o $@ $<
189200
190201 cache: tcc_g
191202 cachegrind ./tcc_g -o /tmp/linpack -lm bench/linpack.c
@@ -195,7 +206,7 @@ cache: tcc_g · 3 unmodified lines
195206 tcc-doc.html: tcc-doc.texi
196207 texi2html -monolithic -number $<
197208
198−FILES= Makefile Makefile.uClibc \
209+FILES= Makefile Makefile.uClibc configure VERSION \
199210 README TODO COPYING \
200211 Changelog tcc-doc.texi tcc-doc.html \
201212 tcc.1 \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t