The goal of stage 06 is to try parse zig synax in lua. I pulled in lpeglable 1.2.0 and parser-gen off github to get started. All of this needs to be cleaned up rather soon. Lua boostraps using tcc and musl from the previous stage. Since musl 0.6.0 doesn't support dynamic linking this build of lua doesn't support shared libraries. I couldn't easily patch musl with dlopen and friends so instead I link statically and call deps with c api.
50 lines
1.8 KiB
Makefile
50 lines
1.8 KiB
Makefile
TCCDIR=tcc-0.9.27
|
|
TCC=$(TCCDIR)/tcc
|
|
TCC0=$(TCC)0
|
|
TCCINST=tcc-bootstrap
|
|
all: out04 a.out $(TCCDIR)/lib/libtcc1.a
|
|
in04: *.b ../04a/out04
|
|
../04a/out04 main.b in04
|
|
out04: in04 ../04/out03
|
|
../04/out03 in04 out04
|
|
%.html: %.md ../markdown
|
|
../markdown $<
|
|
%.out: %.c *.h out04
|
|
./out04 $< $@
|
|
a.out: main.c *.h out04
|
|
./out04
|
|
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) -j8 -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)/
|
|
$(TCC): $(TCC0) musl
|
|
cd $(TCCDIR) && ./tcc0 -nostdinc -nostdlib -B ../tcc-boostrap -I ../musl-bootstrap/include tcc.c ../musl-bootstrap/lib/*.[oa] -o tcc
|
|
tcc: $(TCC)
|
|
|
|
$(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
|
|
clean:
|
|
rm -rf musl-bootstrap
|
|
rm -rf tcc-bootstrap
|
|
rm -f out* README.html *.out *.o $(TCCDIR)/tcc[0123456] $(TCCDIR)/tcc[0123456]a $(TCCDIR)/lib/*.[oa]
|