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 @@
1#1#
2# Tiny C Compiler Makefile2# Tiny C Compiler Makefile
3#3#
4prefix=/usr/local4include config.mak
5manpath=$(prefix)/man
6 5
7CFLAGS=-O2 -g -Wall6CFLAGS=-O2 -g -Wall
8LIBS=-ldl7LIBS=-ldl
9CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC8CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
10LIBS_P=9LIBS_P=
11 10
12CFLAGS+=-m386 -malign-functions=0 -mpreferred-stack-boundary=211CFLAGS+=-mpreferred-stack-boundary=2
13CFLAGS+=-DCONFIG_TCC_PREFIX=\"$(prefix)\"12ifeq ($(GCC_MAJOR),2)
13CFLAGS+=-m386 -malign-functions=0
14else
15CFLAGS+=-march=i386 -falign-functions=0
16endif
17
18
14DISAS=objdump -d19DISAS=objdump -d
15INSTALL=install20INSTALL=install
16VERSION=0.9.16
17 21
18# run local version of tcc with local libraries and includes22# run local version of tcc with local libraries and includes
19TCC=./tcc -B. -I.23TCC=./tcc -B. -I.
20 24
21all: tcc libtcc1.o bcheck.o tcc-doc.html25all: tcc libtcc1.o bcheck.o tcc-doc.html libtcc.a libtcc_test
26
27Makefile: config.mak
22 28
23# auto test29# auto test
24 30
@@ -26,7 +32,7 @@ test: test.ref test.out · 1 unmodified line
26 @if diff -u test.ref test.out ; then echo "Auto Test OK"; fi32 @if diff -u test.ref test.out ; then echo "Auto Test OK"; fi
27 33
28tcctest.ref: tcctest.c 34tcctest.ref: tcctest.c
29 gcc $(CFLAGS) -I. -o $@ $<35 $(CC) $(CFLAGS) -I. -o $@ $<
30 36
31test.ref: tcctest.ref37test.ref: tcctest.ref
32 ./tcctest.ref > $@38 ./tcctest.ref > $@
@@ -96,41 +102,46 @@ speed: tcc ex2 ex3 · 63 unmodified lines
96 time ./tcc -I. ./ex3.c 35102 time ./tcc -I. ./ex3.c 35
97 103
98ex2: ex2.c104ex2: ex2.c
99 gcc $(CFLAGS) -o $@ $<105 $(CC) $(CFLAGS) -o $@ $<
100 106
101ex3: ex3.c107ex3: ex3.c
102 gcc $(CFLAGS) -o $@ $<108 $(CC) $(CFLAGS) -o $@ $<
103 109
104# Native Tiny C Compiler110# Native Tiny C Compiler
105 111
106tcc_g: tcc.c i386-gen.c tccelf.c tccasm.c i386-asm.c tcctok.h libtcc.h i386-asm.h Makefile112tcc_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)
108 114
109tcc: tcc_g115tcc: tcc_g Makefile
110 strip -s -R .comment -R .note -o $@ $<116 strip -s -R .comment -R .note -o $@ $<
111 117
112# TinyCC runtime libraries118# TinyCC runtime libraries
113libtcc1.o: libtcc1.c119libtcc1.o: libtcc1.c
114 gcc -O2 -Wall -c -o $@ $<120 $(CC) -O2 -Wall -c -o $@ $<
115 121
116bcheck.o: bcheck.c122bcheck.o: bcheck.c
117 gcc -O2 -Wall -c -o $@ $<123 $(CC) -O2 -Wall -c -o $@ $<
118 124
119install: tcc libtcc1.o bcheck.o125install: tcc_install libinstall
120 $(INSTALL) -m755 tcc $(prefix)/bin126
121 $(INSTALL) tcc.1 $(manpath)/man1127tcc_install: tcc libtcc1.o bcheck.o
122 mkdir -p $(prefix)/lib/tcc128 $(INSTALL) -m755 tcc $(bindir)
123 mkdir -p $(prefix)/lib/tcc/include129 $(INSTALL) tcc.1 $(mandir)/man1
124 $(INSTALL) -m644 libtcc1.o bcheck.o $(prefix)/lib/tcc130 mkdir -p $(libdir)/tcc
131 mkdir -p $(libdir)/tcc/include
132 $(INSTALL) -m644 libtcc1.o bcheck.o $(libdir)/tcc
125 $(INSTALL) -m644 stdarg.h stddef.h stdbool.h float.h varargs.h \133 $(INSTALL) -m644 stdarg.h stddef.h stdbool.h float.h varargs.h \
126 tcclib.h $(prefix)/lib/tcc/include134 tcclib.h $(libdir)/tcc/include
127 135
128clean:136clean:
129 rm -f *~ *.o tcc tcc1 tcct tcc_g tcctest.ref *.bin *.i ex2 \137 rm -f *~ *.o tcc tcc1 tcct tcc_g tcctest.ref *.bin *.i ex2 \
130 core gmon.out test.out test.ref a.out tcc_p \138 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 \
132 tcctest[1234] test[1234].out140 tcctest[1234] test[1234].out
133 141
142distclean: clean
143 rm -f config.h config.mak
144
134# win32 TCC145# win32 TCC
135tcc_g.exe: tcc.c i386-gen.c bcheck.c Makefile146tcc_g.exe: tcc.c i386-gen.c bcheck.c Makefile
136 i386-mingw32msvc-gcc $(CFLAGS) -DCONFIG_TCC_STATIC -o $@ $<147 i386-mingw32msvc-gcc $(CFLAGS) -DCONFIG_TCC_STATIC -o $@ $<
@@ -140,21 +151,21 @@ tcc.exe: tcc_g.exe · 3 unmodified lines
140 151
141# profiling version152# profiling version
142tcc_p: tcc.c Makefile153tcc_p: tcc.c Makefile
143 gcc $(CFLAGS_P) -o $@ $< $(LIBS_P)154 $(CC) $(CFLAGS_P) -o $@ $< $(LIBS_P)
144 155
145# libtcc generation and example156# libtcc generation and example
146libinstall: libtcc.a 157libinstall: libtcc.a
147 $(INSTALL) -m644 libtcc.a $(prefix)/lib158 $(INSTALL) -m644 libtcc.a $(libdir)
148 $(INSTALL) -m644 libtcc.h $(prefix)/include159 $(INSTALL) -m644 libtcc.h $(includedir)
149 160
150libtcc.o: tcc.c i386-gen.c bcheck.c Makefile161libtcc.o: tcc.c i386-gen.c bcheck.c Makefile
151 gcc $(CFLAGS) -DLIBTCC -c -o $@ $<162 $(CC) $(CFLAGS) -DLIBTCC -c -o $@ $<
152 163
153libtcc.a: libtcc.o 164libtcc.a: libtcc.o
154 ar rcs $@ $^165 $(AR) rcs $@ $^
155 166
156libtcc_test: libtcc_test.c libtcc.a 167libtcc_test: libtcc_test.c libtcc.a
157 gcc $(CFLAGS) -I. -o $@ $< -L. -ltcc -ldl168 $(CC) $(CFLAGS) -I. -o $@ $< -L. -ltcc -ldl
158 169
159libtest: libtcc_test170libtest: libtcc_test
160 ./libtcc_test171 ./libtcc_test
@@ -171,7 +182,7 @@ instr: instr.o · 10 unmodified lines
171# tiny assembler testing182# tiny assembler testing
172 183
173asmtest.ref: asmtest.S184asmtest.ref: asmtest.S
174 gcc -c -o asmtest.ref.o asmtest.S185 $(CC) -c -o asmtest.ref.o asmtest.S
175 objdump -D asmtest.ref.o > $@186 objdump -D asmtest.ref.o > $@
176 187
177# XXX: we compute tcc.c to go faster during development !188# XXX: we compute tcc.c to go faster during development !
@@ -185,7 +196,7 @@ asmtest: asmtest.out asmtest.ref · 7 unmodified lines
185 @if diff -u --ignore-matching-lines="file format" asmtest.ref asmtest.out ; then echo "ASM Auto Test OK"; fi196 @if diff -u --ignore-matching-lines="file format" asmtest.ref asmtest.out ; then echo "ASM Auto Test OK"; fi
186 197
187instr.o: instr.S198instr.o: instr.S
188 gcc -O2 -Wall -g -c -o $@ $<199 $(CC) -O2 -Wall -g -c -o $@ $<
189 200
190cache: tcc_g201cache: tcc_g
191 cachegrind ./tcc_g -o /tmp/linpack -lm bench/linpack.c202 cachegrind ./tcc_g -o /tmp/linpack -lm bench/linpack.c
@@ -195,7 +206,7 @@ cache: tcc_g · 3 unmodified lines
195tcc-doc.html: tcc-doc.texi206tcc-doc.html: tcc-doc.texi
196 texi2html -monolithic -number $<207 texi2html -monolithic -number $<
197 208
198FILES= Makefile Makefile.uClibc \209FILES= Makefile Makefile.uClibc configure VERSION \
199 README TODO COPYING \210 README TODO COPYING \
200 Changelog tcc-doc.texi tcc-doc.html \211 Changelog tcc-doc.texi tcc-doc.html \
201 tcc.1 \212 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