From fe7a0abd38d61a449c4beaa7a514c2be5df872cf Mon Sep 17 00:00:00 2001 From: Dawid Sobczak Date: Sat, 1 Jul 2023 19:19:53 +0100 Subject: testing bootstrap --- 05/.gitignore | 2 ++ 05/Makefile | 14 ++++++++++---- 05/musl-0.6.0/Makefile | 4 ++-- 05/musl-0.6.0/config.mak | 4 ++-- 05/tcc-0.9.27/config.h | 4 ++-- Makefile | 5 ++++- 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/05/.gitignore b/05/.gitignore index 7f437b0..e2ef208 100644 --- a/05/.gitignore +++ b/05/.gitignore @@ -1,3 +1,5 @@ in04 address_map.txt *.o +tcc-bootstrap +musl-bootstrap \ No newline at end of file diff --git a/05/Makefile b/05/Makefile index ea0d9c4..01194ff 100644 --- a/05/Makefile +++ b/05/Makefile @@ -1,8 +1,8 @@ TCCDIR=tcc-0.9.27 TCC=$(TCCDIR)/tcc TCC0=$(TCC)0 -TCCINST=/usr/local/lib/tcc-bootstrap -all: out04 a.out README.html $(TCCDIR)/lib/libtcc1.a +TCCINST=tcc-bootstrap +all: out04 a.out $(TCCDIR)/lib/libtcc1.a in04: *.b ../04a/out04 ../04a/out04 main.b in04 out04: in04 ../04/out03 @@ -27,12 +27,16 @@ $(TCCDIR)/lib/libtcc1.a: $(TCC0) $(TCCDIR)/lib/*.[cS] $(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 -install-tcc0: $(TCCDIR)/lib/libtcc1.a $(TCCDIR)/include/*.h +install: $(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)/ + $(MAKE) -C musl-0.6.0 + $(MAKE) -C musl-0.6.0 install $(TCC)1: $(TCC0) $(TCCINST)/libtcc1.a - cd $(TCCDIR) && ./tcc0 tcc.c -o tcc1 + cd $(TCCDIR) && ./tcc0 -nostdinc -nostdlib -B ../tcc-boostrap -L../musl-bootstrap/lib -lc -I ../musl-bootstrap/include tcc.c -o tcc1 +tcc: $(TCC)1 + $(TCC)2: $(TCC)1 cd $(TCCDIR) && ./tcc1 tcc.c -o tcc2 $(TCC)0a: $(TCCDIR)/*.c $(TCCDIR)/*.h @@ -40,4 +44,6 @@ $(TCC)0a: $(TCCDIR)/*.c $(TCCDIR)/*.h $(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] diff --git a/05/musl-0.6.0/Makefile b/05/musl-0.6.0/Makefile index 9d40be5..460ff31 100644 --- a/05/musl-0.6.0/Makefile +++ b/05/musl-0.6.0/Makefile @@ -9,7 +9,7 @@ # CC = ../tcc-0.9.27/tcc0 -exec_prefix = /usr/local/musl-bootstrap +exec_prefix = ../musl-bootstrapU bindir = $(exec_prefix)/bin prefix = /usr/local/musl-bootstrap @@ -84,7 +84,7 @@ lib/libc.so: $(LOBJS) $(OBJCOPY) --weaken $@ lib/libc.a: $(OBJS) - rm -f $@ + mkdir -p lib $(AR) rc $@ $(OBJS) # $(RANLIB) $@ diff --git a/05/musl-0.6.0/config.mak b/05/musl-0.6.0/config.mak index 55a18ae..81b8052 100644 --- a/05/musl-0.6.0/config.mak +++ b/05/musl-0.6.0/config.mak @@ -6,10 +6,10 @@ ARCH = x86_64 # Installation prefix. DO NOT use /, /usr, or /usr/local ! -prefix = /usr/local/musl-bootstrap +prefix = ../musl-bootstrap # Installation prefix for musl-gcc compiler wrapper. -exec_prefix = /usr/local/musl-bootstrap +exec_prefix = ../musl-bootstrap # Uncomment if you want to build i386 musl on a 64-bit host #CFLAGS += -m32 diff --git a/05/tcc-0.9.27/config.h b/05/tcc-0.9.27/config.h index 2ed06d9..f49b07c 100644 --- a/05/tcc-0.9.27/config.h +++ b/05/tcc-0.9.27/config.h @@ -2,6 +2,6 @@ #define CONFIG_TCC_STATIC 1 #define TCC_TARGET_X86_64 1 #define ONE_SOURCE 1 -#define CONFIG_LDDIR "lib/x86_64-linux-gnu" -#define CONFIG_TCCDIR "/usr/local/lib/tcc-bootstrap" +//#define CONFIG_LDDIR "lib/x86_64-linux-gnu" +#define CONFIG_TCCDIR "../tcc-bootstrap" #define inline diff --git a/Makefile b/Makefile index 323bff9..2df976a 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,9 @@ all: markdown README.html $(MAKE) -C 04 $(MAKE) -C 04a # don't compile all of 05 because it takes a while - $(MAKE) -C 05 README.html + $(MAKE) -C 05 + $(MAKE) -C 05 install + $(MAKE) -C 05 tcc clean: $(MAKE) -C 00 clean $(MAKE) -C 01 clean @@ -14,6 +16,7 @@ clean: $(MAKE) -C 03 clean $(MAKE) -C 04 clean $(MAKE) -C 04a clean + $(MAKE) -C 05 clean rm -f markdown rm -f README.html markdown: markdown.c -- cgit v1.2.3