2 # Tiny C Compiler Makefile
8 CFLAGS_P
=$(CFLAGS
) -pg
-static
-DCONFIG_TCC_STATIC
11 CFLAGS
+=-m386
-malign-functions
=0
20 test: test.ref
test.out
21 @if diff
-u
test.ref
test.out
; then echo
"Auto Test OK"; fi
23 tcctest.ref
: tcctest.c
24 gcc
$(CFLAGS
) -I.
-o
$@
$<
29 test.out
: tcc tcctest.c
30 .
/tcc
-I. tcctest.c
> $@
35 # iterated test2 (compile tcc then compile tcctest.c !)
36 test2
: tcc tcc.c tcctest.c
test.ref
37 .
/tcc
-I. tcc.c
-I. tcctest.c
> test.out2
38 @if diff
-u
test.ref
test.out2
; then echo
"Auto Test2 OK"; fi
40 # iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
41 test3
: tcc tcc.c tcctest.c
test.ref
42 .
/tcc
-I. tcc.c
-I. tcc.c
-I. tcctest.c
> test.out3
43 @if diff
-u
test.ref
test.out3
; then echo
"Auto Test3 OK"; fi
45 # memory and bound check auto test
47 BOUNDS_FAIL
= 2 5 7 9 11 12 13
49 btest
: boundtest.c tcc
50 @for i in
$(BOUNDS_OK
); do \
51 if .
/tcc
-b boundtest.c
$$i ; then \
54 echo Failed positive
test $$i ; exit
1 ; \
57 for i in
$(BOUNDS_FAIL
); do \
58 if .
/tcc
-b boundtest.c
$$i ; then \
59 echo Failed negative
test $$i ; exit
1 ;\
68 time .
/ex2
1238 2 3 4 10 13 4
69 time .
/tcc
-I. .
/ex2.c
1238 2 3 4 10 13 4
71 time .
/tcc
-I. .
/ex3.c
35
74 gcc
$(CFLAGS
) -o
$@
$<
77 gcc
$(CFLAGS
) -o
$@
$<
79 # Native Tiny C Compiler
81 tcc_g
: tcc.c i386-gen.c bcheck.c Makefile
82 gcc
$(CFLAGS
) -o
$@
$< $(LIBS
)
85 strip -s
-R .comment
-R .note
-o
$@
$<
88 $(INSTALL
) -m755 tcc
$(prefix)/bin
89 mkdir
-p
$(prefix)/lib
/tcc
90 $(INSTALL
) -m644 stdarg.h stddef.h float.h stdbool.h \
91 tcclib.h
$(prefix)/lib
/tcc
94 rm -f
*~
*.o tcc tcc1 tcct tcc_g tcctest.ref
*.bin
*.i ex2 \
95 core gmon.out
test.out
test.ref a.out tcc_p \
100 iltcc_g
: tcc.c il-gen.c bcheck.c Makefile
101 gcc
$(CFLAGS
) -DTCC_TARGET_IL
-o
$@
$< $(LIBS
)
104 strip -s
-R .comment
-R .note
-o
$@
$<
107 tcc_g.exe
: tcc.c i386-gen.c bcheck.c Makefile
108 i386-mingw32msvc-gcc
$(CFLAGS
) -DCONFIG_TCC_STATIC
-o
$@
$<
111 i386-mingw32msvc-strip
-o
$@
$<
114 tcc_p
: tcc.c Makefile
115 gcc
$(CFLAGS_P
) -o
$@
$< $(LIBS_P
)
117 # targets for development
120 .
/tcc
-g
-o
$@
-I.
$<
127 gcc
-O2
-Wall
-g
-c
-o
$@
$<
133 cp
-r ..
/tcc
/tmp
/$(FILE
)
134 ( cd
/tmp
; tar zcvf ~
/$(FILE
).
tar.gz \
135 $(FILE
)/Makefile
$(FILE
)/Makefile.uClibc \
136 $(FILE
)/README
$(FILE
)/TODO
$(FILE
)/COPYING \
137 $(FILE
)/Changelog
$(FILE
)/tcc-doc.html \
138 $(FILE
)/tcc.c
$(FILE
)/i386-gen.c
$(FILE
)/bcheck.c \
139 $(FILE
)/il-opcodes.h
$(FILE
)/il-gen.c \
140 $(FILE
)/elf.h
$(FILE
)/stab.h
$(FILE
)/stab.def \
141 $(FILE
)/stddef.h
$(FILE
)/stdarg.h
$(FILE
)/stdbool.h
$(FILE
)/float.h \
143 $(FILE
)/ex
*.c
$(FILE
)/tcctest.c
$(FILE
)/boundtest.c
)