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
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
$@
$<
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
99 gcc
$(CFLAGS_P
) -o
$@
$< $(LIBS_P
)
101 # targets for development
104 .
/tcc
-g
-o
$@
-I.
$<
111 gcc
-O2
-Wall
-g
-c
-o
$@
$<
117 cp
-r ..
/tcc
/tmp
/$(FILE
)
118 ( cd
/tmp
; tar zcvf ~
/$(FILE
).
tar.gz \
119 $(FILE
)/Makefile
$(FILE
)/README
$(FILE
)/TODO
$(FILE
)/COPYING \
120 $(FILE
)/Changelog
$(FILE
)/tcc-doc.html \
121 $(FILE
)/tcc.c
$(FILE
)/i386-gen.c
$(FILE
)/bcheck.c \
122 $(FILE
)/stddef.h
$(FILE
)/stdarg.h
$(FILE
)/stdbool.h
$(FILE
)/float.h \
124 $(FILE
)/ex
*.c
$(FILE
)/tcctest.c
$(FILE
)/boundtest.c
)