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
49 # memory and bound check auto test
51 BOUNDS_FAIL
= 2 5 7 9 11 12 13
53 btest
: boundtest.c tcc
54 @for i in
$(BOUNDS_OK
); do \
55 if
$(TCC
) -b boundtest.c
$$i ; then \
58 echo Failed positive
test $$i ; exit
1 ; \
61 for i in
$(BOUNDS_FAIL
); do \
62 if
$(TCC
) -b boundtest.c
$$i ; then \
63 echo Failed negative
test $$i ; exit
1 ;\
72 time .
/ex2
1238 2 3 4 10 13 4
73 time .
/tcc
-I. .
/ex2.c
1238 2 3 4 10 13 4
75 time .
/tcc
-I. .
/ex3.c
35
78 gcc
$(CFLAGS
) -o
$@
$<
81 gcc
$(CFLAGS
) -o
$@
$<
83 # Native Tiny C Compiler
85 tcc_g
: tcc.c i386-gen.c bcheck.c tcctok.h libtcc.h Makefile
86 gcc
$(CFLAGS
) -o
$@
$< $(LIBS
)
89 strip -s
-R .comment
-R .note
-o
$@
$<
91 # TinyCC runtime libraries
93 gcc
-O2
-Wall
-c
-o
$@
$<
96 gcc
-O2
-Wall
-c
-o
$@
$<
98 install: tcc libtcc1.o bcheck.o
99 $(INSTALL
) -m755 tcc
$(prefix)/bin
100 $(INSTALL
) tcc
.1 $(prefix)/man
/man1
101 mkdir
-p
$(prefix)/lib
/tcc
102 mkdir
-p
$(prefix)/lib
/tcc
/include
103 $(INSTALL
) -m644 libtcc1.o bcheck.o
$(prefix)/lib
/tcc
104 $(INSTALL
) -m644 stdarg.h stddef.h float.h stdbool.h \
105 tcclib.h
$(prefix)/lib
/tcc
/include
108 rm -f
*~
*.o tcc tcc1 tcct tcc_g tcctest.ref
*.bin
*.i ex2 \
109 core gmon.out
test.out
test.ref a.out tcc_p \
114 iltcc_g
: tcc.c il-gen.c bcheck.c Makefile
115 gcc
$(CFLAGS
) -DTCC_TARGET_IL
-o
$@
$< $(LIBS
)
118 strip -s
-R .comment
-R .note
-o
$@
$<
121 tcc_g.exe
: tcc.c i386-gen.c bcheck.c Makefile
122 i386-mingw32msvc-gcc
$(CFLAGS
) -DCONFIG_TCC_STATIC
-o
$@
$<
125 i386-mingw32msvc-strip
-o
$@
$<
128 tcc_p
: tcc.c Makefile
129 gcc
$(CFLAGS_P
) -o
$@
$< $(LIBS_P
)
131 # libtcc generation and example
133 $(INSTALL
) -m644 libtcc.a
$(prefix)/lib
134 $(INSTALL
) -m644 libtcc.h
$(prefix)/include
136 libtcc.o
: tcc.c i386-gen.c bcheck.c Makefile
137 gcc
$(CFLAGS
) -DLIBTCC
-c
-o
$@
$<
142 libtcc_test
: libtcc_test.c libtcc.a
143 gcc
$(CFLAGS
) -I.
-o
$@
$< -L.
-ltcc
-ldl
145 # targets for development
155 gcc
-O2
-Wall
-g
-c
-o
$@
$<
158 tcc-doc.html
: tcc-doc.texi
159 texi2html
-monolithic
-number
$<
165 cp
-r ..
/tcc
/tmp
/$(FILE
)
166 ( cd
/tmp
; tar zcvf ~
/$(FILE
).
tar.gz \
167 $(FILE
)/Makefile
$(FILE
)/Makefile.uClibc \
168 $(FILE
)/README
$(FILE
)/TODO
$(FILE
)/COPYING \
169 $(FILE
)/Changelog
$(FILE
)/tcc-doc.texi
$(FILE
)/tcc-doc.html \
171 $(FILE
)/tcc.c
$(FILE
)/i386-gen.c
$(FILE
)/tcctok.h \
172 $(FILE
)/bcheck.c
$(FILE
)/libtcc1.c \
173 $(FILE
)/il-opcodes.h
$(FILE
)/il-gen.c \
174 $(FILE
)/elf.h
$(FILE
)/stab.h
$(FILE
)/stab.def \
175 $(FILE
)/stddef.h
$(FILE
)/stdarg.h
$(FILE
)/stdbool.h
$(FILE
)/float.h \
176 $(FILE
)/tcclib.h
$(FILE
)/libtcc.h
$(FILE
)/libtcc_test.c \
177 $(FILE
)/ex
*.c
$(FILE
)/tcctest.c
$(FILE
)/boundtest.c
)