2 # Tiny C Compiler Makefile
8 CFLAGS_P
=$(CFLAGS
) -pg
-static
-DCONFIG_TCC_STATIC
11 CFLAGS
+=-m386
-malign-functions
=0
12 CFLAGS
+=-DCONFIG_TCC_PREFIX
=\"$(prefix)\"
17 # run local version of tcc with local libraries and includes
20 all: tcc libtcc1.o bcheck.o tcc-doc.html
24 test: test.ref
test.out
25 @if diff
-u
test.ref
test.out
; then echo
"Auto Test OK"; fi
27 tcctest.ref
: tcctest.c
28 gcc
$(CFLAGS
) -I.
-o
$@
$<
33 test.out
: tcc tcctest.c
39 # iterated test2 (compile tcc then compile tcctest.c !)
40 test2
: tcc tcc.c tcctest.c
test.ref
41 $(TCC
) tcc.c
-B.
-I. tcctest.c
> test.out2
42 @if diff
-u
test.ref
test.out2
; then echo
"Auto Test2 OK"; fi
44 # iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
45 test3
: tcc tcc.c tcctest.c
test.ref
46 $(TCC
) tcc.c
-B.
-I. tcc.c
-B.
-I. tcctest.c
> test.out3
47 @if diff
-u
test.ref
test.out3
; then echo
"Auto Test3 OK"; fi
52 $(TCC
) -o tcctest1 tcctest.c
53 .
/tcctest1
> test1.out
54 @if diff
-u
test.ref test1.out
; then echo
"Dynamic Auto Test OK"; fi
56 $(TCC
) -static
-o tcctest2 tcctest.c
57 .
/tcctest2
> test2.out
58 @if diff
-u
test.ref test2.out
; then echo
"Static Auto Test OK"; fi
59 # object + link output
60 $(TCC
) -c
-o tcctest3.o tcctest.c
61 $(TCC
) -o tcctest3 tcctest3.o
62 .
/tcctest3
> test3.out
63 @if diff
-u
test.ref test3.out
; then echo
"Object Auto Test OK"; fi
64 # dynamic output + bound check
65 $(TCC
) -b
-o tcctest4 tcctest.c
66 .
/tcctest4
> test4.out
67 @if diff
-u
test.ref test4.out
; then echo
"BCheck Auto Test OK"; fi
69 # memory and bound check auto test
71 BOUNDS_FAIL
= 2 5 7 9 11 12 13
73 btest
: boundtest.c tcc
74 @for i in
$(BOUNDS_OK
); do \
75 if
$(TCC
) -b boundtest.c
$$i ; then \
78 echo Failed positive
test $$i ; exit
1 ; \
81 for i in
$(BOUNDS_FAIL
); do \
82 if
$(TCC
) -b boundtest.c
$$i ; then \
83 echo Failed negative
test $$i ; exit
1 ;\
92 time .
/ex2
1238 2 3 4 10 13 4
93 time .
/tcc
-I. .
/ex2.c
1238 2 3 4 10 13 4
95 time .
/tcc
-I. .
/ex3.c
35
98 gcc
$(CFLAGS
) -o
$@
$<
101 gcc
$(CFLAGS
) -o
$@
$<
103 # Native Tiny C Compiler
105 tcc_g
: tcc.c i386-gen.c tccelf.c tcctok.h libtcc.h Makefile
106 gcc
$(CFLAGS
) -o
$@
$< $(LIBS
)
109 strip -s
-R .comment
-R .note
-o
$@
$<
111 # TinyCC runtime libraries
113 gcc
-O2
-Wall
-c
-o
$@
$<
116 gcc
-O2
-Wall
-c
-o
$@
$<
118 install: tcc libtcc1.o bcheck.o
119 $(INSTALL
) -m755 tcc
$(prefix)/bin
120 $(INSTALL
) tcc
.1 $(prefix)/share
/man
/man1
121 mkdir
-p
$(prefix)/lib
/tcc
122 mkdir
-p
$(prefix)/lib
/tcc
/include
123 $(INSTALL
) -m644 libtcc1.o bcheck.o
$(prefix)/lib
/tcc
124 $(INSTALL
) -m644 stdarg.h stddef.h float.h stdbool.h \
125 tcclib.h
$(prefix)/lib
/tcc
/include
128 rm -f
*~
*.o tcc tcc1 tcct tcc_g tcctest.ref
*.bin
*.i ex2 \
129 core gmon.out
test.out
test.ref a.out tcc_p \
130 *.exe iltcc iltcc_g tcc-doc.html \
131 tcctest
[1234] test[1234].out
135 iltcc_g
: tcc.c il-gen.c bcheck.c Makefile
136 gcc
$(CFLAGS
) -DTCC_TARGET_IL
-o
$@
$< $(LIBS
)
139 strip -s
-R .comment
-R .note
-o
$@
$<
142 tcc_g.exe
: tcc.c i386-gen.c bcheck.c Makefile
143 i386-mingw32msvc-gcc
$(CFLAGS
) -DCONFIG_TCC_STATIC
-o
$@
$<
146 i386-mingw32msvc-strip
-o
$@
$<
149 tcc_p
: tcc.c Makefile
150 gcc
$(CFLAGS_P
) -o
$@
$< $(LIBS_P
)
152 # libtcc generation and example
154 $(INSTALL
) -m644 libtcc.a
$(prefix)/lib
155 $(INSTALL
) -m644 libtcc.h
$(prefix)/include
157 libtcc.o
: tcc.c i386-gen.c bcheck.c Makefile
158 gcc
$(CFLAGS
) -DLIBTCC
-c
-o
$@
$<
163 libtcc_test
: libtcc_test.c libtcc.a
164 gcc
$(CFLAGS
) -I.
-o
$@
$< -L.
-ltcc
-ldl
166 # targets for development
176 gcc
-O2
-Wall
-g
-c
-o
$@
$<
179 tcc-doc.html
: tcc-doc.texi
180 texi2html
-monolithic
-number
$<
186 cp
-r ..
/tcc
/tmp
/$(FILE
)
187 ( cd
/tmp
; tar zcvf ~
/$(FILE
).
tar.gz \
188 $(FILE
)/Makefile
$(FILE
)/Makefile.uClibc \
189 $(FILE
)/README
$(FILE
)/TODO
$(FILE
)/COPYING \
190 $(FILE
)/Changelog
$(FILE
)/tcc-doc.texi
$(FILE
)/tcc-doc.html \
192 $(FILE
)/tcc.c
$(FILE
)/i386-gen.c
$(FILE
)/tccelf.c
$(FILE
)/tcctok.h \
193 $(FILE
)/bcheck.c
$(FILE
)/libtcc1.c \
194 $(FILE
)/il-opcodes.h
$(FILE
)/il-gen.c \
195 $(FILE
)/elf.h
$(FILE
)/stab.h
$(FILE
)/stab.def \
196 $(FILE
)/stddef.h
$(FILE
)/stdarg.h
$(FILE
)/stdbool.h
$(FILE
)/float.h \
197 $(FILE
)/tcclib.h
$(FILE
)/libtcc.h
$(FILE
)/libtcc_test.c \
198 $(FILE
)/ex
*.c
$(FILE
)/tcctest.c
$(FILE
)/boundtest.c
)