added configure - gcc 3.x support
This commit is contained in:
parent
f46a02a360
commit
cb96022ab7
1 changed files with 41 additions and 30 deletions
71
Makefile
71
Makefile
|
|
@ -1,24 +1,30 @@
|
||||||
#
|
#
|
||||||
# Tiny C Compiler Makefile
|
# Tiny C Compiler Makefile
|
||||||
#
|
#
|
||||||
prefix=/usr/local
|
include config.mak
|
||||||
manpath=$(prefix)/man
|
|
||||||
|
|
||||||
CFLAGS=-O2 -g -Wall
|
CFLAGS=-O2 -g -Wall
|
||||||
LIBS=-ldl
|
LIBS=-ldl
|
||||||
CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
|
CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
|
||||||
LIBS_P=
|
LIBS_P=
|
||||||
|
|
||||||
CFLAGS+=-m386 -malign-functions=0 -mpreferred-stack-boundary=2
|
CFLAGS+=-mpreferred-stack-boundary=2
|
||||||
CFLAGS+=-DCONFIG_TCC_PREFIX=\"$(prefix)\"
|
ifeq ($(GCC_MAJOR),2)
|
||||||
|
CFLAGS+=-m386 -malign-functions=0
|
||||||
|
else
|
||||||
|
CFLAGS+=-march=i386 -falign-functions=0
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
DISAS=objdump -d
|
DISAS=objdump -d
|
||||||
INSTALL=install
|
INSTALL=install
|
||||||
VERSION=0.9.16
|
|
||||||
|
|
||||||
# run local version of tcc with local libraries and includes
|
# run local version of tcc with local libraries and includes
|
||||||
TCC=./tcc -B. -I.
|
TCC=./tcc -B. -I.
|
||||||
|
|
||||||
all: tcc libtcc1.o bcheck.o tcc-doc.html
|
all: tcc libtcc1.o bcheck.o tcc-doc.html libtcc.a libtcc_test
|
||||||
|
|
||||||
|
Makefile: config.mak
|
||||||
|
|
||||||
# auto test
|
# auto test
|
||||||
|
|
||||||
|
|
@ -26,7 +32,7 @@ test: test.ref test.out
|
||||||
@if diff -u test.ref test.out ; then echo "Auto Test OK"; fi
|
@if diff -u test.ref test.out ; then echo "Auto Test OK"; fi
|
||||||
|
|
||||||
tcctest.ref: tcctest.c
|
tcctest.ref: tcctest.c
|
||||||
gcc $(CFLAGS) -I. -o $@ $<
|
$(CC) $(CFLAGS) -I. -o $@ $<
|
||||||
|
|
||||||
test.ref: tcctest.ref
|
test.ref: tcctest.ref
|
||||||
./tcctest.ref > $@
|
./tcctest.ref > $@
|
||||||
|
|
@ -96,41 +102,46 @@ speed: tcc ex2 ex3
|
||||||
time ./tcc -I. ./ex3.c 35
|
time ./tcc -I. ./ex3.c 35
|
||||||
|
|
||||||
ex2: ex2.c
|
ex2: ex2.c
|
||||||
gcc $(CFLAGS) -o $@ $<
|
$(CC) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
ex3: ex3.c
|
ex3: ex3.c
|
||||||
gcc $(CFLAGS) -o $@ $<
|
$(CC) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
# Native Tiny C Compiler
|
# Native Tiny C Compiler
|
||||||
|
|
||||||
tcc_g: tcc.c i386-gen.c tccelf.c tccasm.c i386-asm.c tcctok.h libtcc.h i386-asm.h Makefile
|
tcc_g: tcc.c i386-gen.c tccelf.c tccasm.c i386-asm.c tcctok.h libtcc.h i386-asm.h Makefile
|
||||||
gcc $(CFLAGS) -o $@ $< $(LIBS)
|
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
|
||||||
|
|
||||||
tcc: tcc_g
|
tcc: tcc_g Makefile
|
||||||
strip -s -R .comment -R .note -o $@ $<
|
strip -s -R .comment -R .note -o $@ $<
|
||||||
|
|
||||||
# TinyCC runtime libraries
|
# TinyCC runtime libraries
|
||||||
libtcc1.o: libtcc1.c
|
libtcc1.o: libtcc1.c
|
||||||
gcc -O2 -Wall -c -o $@ $<
|
$(CC) -O2 -Wall -c -o $@ $<
|
||||||
|
|
||||||
bcheck.o: bcheck.c
|
bcheck.o: bcheck.c
|
||||||
gcc -O2 -Wall -c -o $@ $<
|
$(CC) -O2 -Wall -c -o $@ $<
|
||||||
|
|
||||||
install: tcc libtcc1.o bcheck.o
|
install: tcc_install libinstall
|
||||||
$(INSTALL) -m755 tcc $(prefix)/bin
|
|
||||||
$(INSTALL) tcc.1 $(manpath)/man1
|
tcc_install: tcc libtcc1.o bcheck.o
|
||||||
mkdir -p $(prefix)/lib/tcc
|
$(INSTALL) -m755 tcc $(bindir)
|
||||||
mkdir -p $(prefix)/lib/tcc/include
|
$(INSTALL) tcc.1 $(mandir)/man1
|
||||||
$(INSTALL) -m644 libtcc1.o bcheck.o $(prefix)/lib/tcc
|
mkdir -p $(libdir)/tcc
|
||||||
|
mkdir -p $(libdir)/tcc/include
|
||||||
|
$(INSTALL) -m644 libtcc1.o bcheck.o $(libdir)/tcc
|
||||||
$(INSTALL) -m644 stdarg.h stddef.h stdbool.h float.h varargs.h \
|
$(INSTALL) -m644 stdarg.h stddef.h stdbool.h float.h varargs.h \
|
||||||
tcclib.h $(prefix)/lib/tcc/include
|
tcclib.h $(libdir)/tcc/include
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *~ *.o tcc tcc1 tcct tcc_g tcctest.ref *.bin *.i ex2 \
|
rm -f *~ *.o tcc tcc1 tcct tcc_g tcctest.ref *.bin *.i ex2 \
|
||||||
core gmon.out test.out test.ref a.out tcc_p \
|
core gmon.out test.out test.ref a.out tcc_p \
|
||||||
*.exe tcc-doc.html \
|
*.exe tcc-doc.html libtcc.a libtcc_test \
|
||||||
tcctest[1234] test[1234].out
|
tcctest[1234] test[1234].out
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.h config.mak
|
||||||
|
|
||||||
# win32 TCC
|
# win32 TCC
|
||||||
tcc_g.exe: tcc.c i386-gen.c bcheck.c Makefile
|
tcc_g.exe: tcc.c i386-gen.c bcheck.c Makefile
|
||||||
i386-mingw32msvc-gcc $(CFLAGS) -DCONFIG_TCC_STATIC -o $@ $<
|
i386-mingw32msvc-gcc $(CFLAGS) -DCONFIG_TCC_STATIC -o $@ $<
|
||||||
|
|
@ -140,21 +151,21 @@ tcc.exe: tcc_g.exe
|
||||||
|
|
||||||
# profiling version
|
# profiling version
|
||||||
tcc_p: tcc.c Makefile
|
tcc_p: tcc.c Makefile
|
||||||
gcc $(CFLAGS_P) -o $@ $< $(LIBS_P)
|
$(CC) $(CFLAGS_P) -o $@ $< $(LIBS_P)
|
||||||
|
|
||||||
# libtcc generation and example
|
# libtcc generation and example
|
||||||
libinstall: libtcc.a
|
libinstall: libtcc.a
|
||||||
$(INSTALL) -m644 libtcc.a $(prefix)/lib
|
$(INSTALL) -m644 libtcc.a $(libdir)
|
||||||
$(INSTALL) -m644 libtcc.h $(prefix)/include
|
$(INSTALL) -m644 libtcc.h $(includedir)
|
||||||
|
|
||||||
libtcc.o: tcc.c i386-gen.c bcheck.c Makefile
|
libtcc.o: tcc.c i386-gen.c bcheck.c Makefile
|
||||||
gcc $(CFLAGS) -DLIBTCC -c -o $@ $<
|
$(CC) $(CFLAGS) -DLIBTCC -c -o $@ $<
|
||||||
|
|
||||||
libtcc.a: libtcc.o
|
libtcc.a: libtcc.o
|
||||||
ar rcs $@ $^
|
$(AR) rcs $@ $^
|
||||||
|
|
||||||
libtcc_test: libtcc_test.c libtcc.a
|
libtcc_test: libtcc_test.c libtcc.a
|
||||||
gcc $(CFLAGS) -I. -o $@ $< -L. -ltcc -ldl
|
$(CC) $(CFLAGS) -I. -o $@ $< -L. -ltcc -ldl
|
||||||
|
|
||||||
libtest: libtcc_test
|
libtest: libtcc_test
|
||||||
./libtcc_test
|
./libtcc_test
|
||||||
|
|
@ -171,7 +182,7 @@ instr: instr.o
|
||||||
# tiny assembler testing
|
# tiny assembler testing
|
||||||
|
|
||||||
asmtest.ref: asmtest.S
|
asmtest.ref: asmtest.S
|
||||||
gcc -c -o asmtest.ref.o asmtest.S
|
$(CC) -c -o asmtest.ref.o asmtest.S
|
||||||
objdump -D asmtest.ref.o > $@
|
objdump -D asmtest.ref.o > $@
|
||||||
|
|
||||||
# XXX: we compute tcc.c to go faster during development !
|
# XXX: we compute tcc.c to go faster during development !
|
||||||
|
|
@ -185,7 +196,7 @@ asmtest: asmtest.out asmtest.ref
|
||||||
@if diff -u --ignore-matching-lines="file format" asmtest.ref asmtest.out ; then echo "ASM Auto Test OK"; fi
|
@if diff -u --ignore-matching-lines="file format" asmtest.ref asmtest.out ; then echo "ASM Auto Test OK"; fi
|
||||||
|
|
||||||
instr.o: instr.S
|
instr.o: instr.S
|
||||||
gcc -O2 -Wall -g -c -o $@ $<
|
$(CC) -O2 -Wall -g -c -o $@ $<
|
||||||
|
|
||||||
cache: tcc_g
|
cache: tcc_g
|
||||||
cachegrind ./tcc_g -o /tmp/linpack -lm bench/linpack.c
|
cachegrind ./tcc_g -o /tmp/linpack -lm bench/linpack.c
|
||||||
|
|
@ -195,7 +206,7 @@ cache: tcc_g
|
||||||
tcc-doc.html: tcc-doc.texi
|
tcc-doc.html: tcc-doc.texi
|
||||||
texi2html -monolithic -number $<
|
texi2html -monolithic -number $<
|
||||||
|
|
||||||
FILES= Makefile Makefile.uClibc \
|
FILES= Makefile Makefile.uClibc configure VERSION \
|
||||||
README TODO COPYING \
|
README TODO COPYING \
|
||||||
Changelog tcc-doc.texi tcc-doc.html \
|
Changelog tcc-doc.texi tcc-doc.html \
|
||||||
tcc.1 \
|
tcc.1 \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue