lang-bootstrap/05/Makefile

51 lines
1.8 KiB
Makefile
Raw Normal View History

2022-02-18 14:15:09 -05:00
TCCDIR=tcc-0.9.27
2022-02-19 18:22:57 -08:00
TCC=$(TCCDIR)/tcc
TCC0=$(TCC)0
2023-07-01 19:19:53 +01:00
TCCINST=tcc-bootstrap
all: out04 a.out $(TCCDIR)/lib/libtcc1.a
2022-01-07 23:32:27 -05:00
in04: *.b ../04a/out04
../04a/out04 main.b in04
out04: in04 ../04/out03
../04/out03 in04 out04
%.html: %.md ../markdown
../markdown $<
2022-02-14 16:52:33 -05:00
%.out: %.c *.h out04
2022-01-07 23:32:27 -05:00
./out04 $< $@
2022-02-14 16:52:33 -05:00
a.out: main.c *.h out04
./out04
2022-02-19 18:22:57 -08:00
test.out: test.s.o test.c.o
$(TCC0) -static -nostdlib test.s.o test.c.o -o test.out
test.s.o: $(TCC0) test.s
$(TCC0) -static -nostdlib -c test.s -o test.s.o
test.c.o: $(TCC0) test.c
$(TCC0) -static -nostdlib -c test.c -o test.c.o
$(TCC0): $(TCCDIR)/*.c $(TCCDIR)/*.h out04
cd $(TCCDIR) && ../out04 tcc.c tcc0
$(TCCDIR)/lib/libtcc1.a: $(TCC0) $(TCCDIR)/lib/*.[cS]
$(TCC0) -c $(TCCDIR)/lib/alloca86_64-bt.S -o $(TCCDIR)/lib/alloca86_64-bt.o
$(TCC0) -c $(TCCDIR)/lib/alloca86_64.S -o $(TCCDIR)/lib/alloca86_64.o
$(TCC0) -c $(TCCDIR)/lib/va_list.c -o $(TCCDIR)/lib/va_list.o
$(TCC0) -c $(TCCDIR)/lib/libtcc1.c -o $(TCCDIR)/lib/libtcc1.o
$(TCC0) -ar $(TCCDIR)/lib/libtcc1.a $(TCCDIR)/lib/*.o
musl: tcc-files
$(MAKE) -C musl-0.6.0
$(MAKE) -C musl-0.6.0 install
tcc-files: $(TCCDIR)/lib/libtcc1.a $(TCCDIR)/include/*.h
mkdir -p $(TCCINST)/include
cp -r $(TCCDIR)/include/*.h $(TCCINST)/include/
cp -r $(TCCDIR)/lib/libtcc1.a $(TCCINST)/
2022-02-19 18:22:57 -08:00
$(TCC)1: $(TCC0) $(TCCINST)/libtcc1.a
2023-07-01 19:19:53 +01:00
cd $(TCCDIR) && ./tcc0 -nostdinc -nostdlib -B ../tcc-boostrap -L../musl-bootstrap/lib -lc -I ../musl-bootstrap/include tcc.c -o tcc1
tcc: $(TCC)1
2022-02-19 18:22:57 -08:00
$(TCC)2: $(TCC)1
cd $(TCCDIR) && ./tcc1 tcc.c -o tcc2
$(TCC)0a: $(TCCDIR)/*.c $(TCCDIR)/*.h
cd $(TCCDIR) && gcc tcc.c -o tcc0a
$(TCC)1a: $(TCCDIR)/*.c $(TCCDIR)/*.h
cd $(TCCDIR) && ./tcc0a tcc.c -o tcc1a
2022-01-07 23:32:27 -05:00
clean:
2023-07-01 19:19:53 +01:00
rm -rf musl-bootstrap
rm -rf tcc-bootstrap
2022-02-19 12:21:07 -05:00
rm -f out* README.html *.out *.o $(TCCDIR)/tcc[0123456] $(TCCDIR)/tcc[0123456]a $(TCCDIR)/lib/*.[oa]