2 # Tiny C Compiler Makefile
9 CFLAGS_P
=$(CFLAGS
) -pg
-static
-DCONFIG_TCC_STATIC
12 CFLAGS
+=-m386
-malign-functions
=0 -mpreferred-stack-boundary
=2
13 CFLAGS
+=-DCONFIG_TCC_PREFIX
=\"$(prefix)\"
18 # run local version of tcc with local libraries and includes
21 all: tcc libtcc1.o bcheck.o tcc-doc.html
25 test: test.ref
test.out
26 @if diff
-u
test.ref
test.out
; then echo
"Auto Test OK"; fi
28 tcctest.ref
: tcctest.c
29 gcc
$(CFLAGS
) -I.
-o
$@
$<
34 test.out
: tcc tcctest.c
40 # iterated test2 (compile tcc then compile tcctest.c !)
41 test2
: tcc tcc.c tcctest.c
test.ref
42 $(TCC
) tcc.c
-B.
-I. tcctest.c
> test.out2
43 @if diff
-u
test.ref
test.out2
; then echo
"Auto Test2 OK"; fi
45 # iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
46 test3
: tcc tcc.c tcctest.c
test.ref
47 $(TCC
) tcc.c
-B.
-I. tcc.c
-B.
-I. tcctest.c
> test.out3
48 @if diff
-u
test.ref
test.out3
; then echo
"Auto Test3 OK"; fi
53 $(TCC
) -o tcctest1 tcctest.c
54 .
/tcctest1
> test1.out
55 @if diff
-u
test.ref test1.out
; then echo
"Dynamic Auto Test OK"; fi
57 $(TCC
) -static
-o tcctest2 tcctest.c
58 .
/tcctest2
> test2.out
59 @if diff
-u
test.ref test2.out
; then echo
"Static Auto Test OK"; fi
60 # object + link output
61 $(TCC
) -c
-o tcctest3.o tcctest.c
62 $(TCC
) -o tcctest3 tcctest3.o
63 .
/tcctest3
> test3.out
64 @if diff
-u
test.ref test3.out
; then echo
"Object Auto Test OK"; fi
65 # dynamic output + bound check
66 $(TCC
) -b
-o tcctest4 tcctest.c
67 .
/tcctest4
> test4.out
68 @if diff
-u
test.ref test4.out
; then echo
"BCheck Auto Test OK"; fi
70 # memory and bound check auto test
72 BOUNDS_FAIL
= 2 5 7 9 11 12 13
74 btest
: boundtest.c tcc
75 @for i in
$(BOUNDS_OK
); do \
76 if
$(TCC
) -b boundtest.c
$$i ; then \
79 echo Failed positive
test $$i ; exit
1 ; \
82 for i in
$(BOUNDS_FAIL
); do \
83 if
$(TCC
) -b boundtest.c
$$i ; then \
84 echo Failed negative
test $$i ; exit
1 ;\
93 time .
/ex2
1238 2 3 4 10 13 4
94 time .
/tcc
-I. .
/ex2.c
1238 2 3 4 10 13 4
96 time .
/tcc
-I. .
/ex3.c
35
99 gcc
$(CFLAGS
) -o
$@
$<
102 gcc
$(CFLAGS
) -o
$@
$<
104 # Native Tiny C Compiler
106 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
)
110 strip -s
-R .comment
-R .note
-o
$@
$<
112 # TinyCC runtime libraries
114 gcc
-O2
-Wall
-c
-o
$@
$<
117 gcc
-O2
-Wall
-c
-o
$@
$<
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
125 $(INSTALL
) -m644 stdarg.h stddef.h stdbool.h float.h varargs.h \
126 tcclib.h
$(prefix)/lib
/tcc
/include
129 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 \
132 tcctest
[1234] test[1234].out
135 tcc_g.exe
: tcc.c i386-gen.c bcheck.c Makefile
136 i386-mingw32msvc-gcc
$(CFLAGS
) -DCONFIG_TCC_STATIC
-o
$@
$<
139 i386-mingw32msvc-strip
-o
$@
$<
142 tcc_p
: tcc.c Makefile
143 gcc
$(CFLAGS_P
) -o
$@
$< $(LIBS_P
)
145 # libtcc generation and example
147 $(INSTALL
) -m644 libtcc.a
$(prefix)/lib
148 $(INSTALL
) -m644 libtcc.h
$(prefix)/include
150 libtcc.o
: tcc.c i386-gen.c bcheck.c Makefile
151 gcc
$(CFLAGS
) -DLIBTCC
-c
-o
$@
$<
156 libtcc_test
: libtcc_test.c libtcc.a
157 gcc
$(CFLAGS
) -I.
-o
$@
$< -L.
-ltcc
-ldl
162 # targets for development
171 # tiny assembler testing
173 asmtest.ref
: asmtest.S
174 gcc
-c
-o asmtest.ref.o asmtest.S
175 objdump
-D asmtest.ref.o
> $@
177 # XXX: we compute tcc.c to go faster during development !
178 asmtest.out
: asmtest.S tcc
179 # ./tcc tcc.c -c asmtest.S
180 #asmtest.out: asmtest.S tcc
182 objdump
-D asmtest.o
> $@
184 asmtest
: asmtest.out asmtest.ref
185 @if diff
-u
--ignore-matching-lines
="file format" asmtest.ref asmtest.out
; then echo
"ASM Auto Test OK"; fi
188 gcc
-O2
-Wall
-g
-c
-o
$@
$<
191 cachegrind .
/tcc_g
-o
/tmp
/linpack
-lm bench
/linpack.c
192 vg_annotate tcc.c
> /tmp
/linpack.cache.log
195 tcc-doc.html
: tcc-doc.texi
196 texi2html
-monolithic
-number
$<
198 FILES
= Makefile Makefile.uClibc \
199 README TODO COPYING \
200 Changelog tcc-doc.texi tcc-doc.html \
202 tcc.c i386-gen.c tccelf.c tcctok.h tccasm.c i386-asm.c i386-asm.h\
204 elf.h stab.h stab.def \
205 stddef.h stdarg.h stdbool.h float.h varargs.h \
206 tcclib.h libtcc.h libtcc_test.c \
207 ex1.c ex2.c ex3.c ex4.c ex5.c \
208 tcctest.c boundtest.c gcctestsuite.sh
214 mkdir
-p
/tmp
/$(FILE
)
215 cp
-P
$(FILES
) /tmp
/$(FILE
)
216 ( cd
/tmp
; tar zcvf ~
/$(FILE
).
tar.gz
$(FILE
) )