commit 18558d023079b549c0454228feab70a6e27c67f0
parent 06e10502ad1191381a674c2621738f38d7943c26
Author: Quentin Rameau <quinq@fifth.space>
Date: Wed, 22 Mar 2017 09:59:02 +0100
[crt] Add crt to (un)install target
Diffstat:
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
@@ -4,7 +4,7 @@
include config.mk
-DIRS = lib cc1 cc2 driver/$(DRIVER) libc/src
+DIRS = lib cc1 cc2 crt driver/$(DRIVER) libc/src
all: scc-driver
for i in $(ARCHS); \
@@ -17,13 +17,19 @@ scc-driver:
ln -f driver/$(DRIVER)/scc bin/scc
$(ARCHS):
- pwd=$$PWD ;\
+ pwd=$$PWD; \
for i in cc1 cc2; \
do \
cd $$i; \
ARCH=$@ $(MAKE) -e $$i-$@ || exit; \
- cd $$pwd ;\
+ cd $$pwd; \
done
+ cd crt; \
+ for i in $(SYSS); \
+ do \
+ ARCH=$@ SYS=$$i $(MAKE) -e || exit; \
+ done; \
+ cd $$pwd;
ln -f cc1/cc1-$@ bin/
ln -f cc2/cc2-$@ bin/
@@ -39,9 +45,11 @@ install: all
mkdir -p $(DESTDIR)/$(PREFIX)/libexec/scc/
mkdir -p $(DESTDIR)/$(PREFIX)/bin/
mkdir -p $(DESTDIR)/$(PREFIX)/include/scc/
+ mkdir -p $(DESTDIR)/$(PREFIX)/lib/scc/
cp -f bin/cc?-* $(DESTDIR)/$(PREFIX)/libexec/scc/
cp -f bin/cpp.sh $(DESTDIR)/$(PREFIX)/bin/scpp
cp -f bin/scc $(DESTDIR)/$(PREFIX)/bin/
+ cp -f crt/crt-*.o $(DESTDIR)/$(PREFIX)/lib/scc/
cp -fr libc/include/* $(DESTDIR)/$(PREFIX)/include/scc/
find $(DESTDIR)/$(PREFIX)/include/scc/ -type f | xargs chmod 644
cd $(DESTDIR)/$(PREFIX)/libexec/scc/ && chmod 755 cc* && strip cc*
@@ -50,6 +58,7 @@ install: all
uninstall:
rm -rf $(DESTDIR)/$(PREFIX)/include/scc/
rm -rf $(DESTDIR)/$(PREFIX)/libexec/scc/
+ rm -rf $(DESTDIR)/$(PREFIX)/lib/scc/
rm -f $(DESTDIR)/$(PREFIX)/bin/scc
rm -f $(DESTDIR)/$(PREFIX)/bin/scpp
diff --git a/config.mk b/config.mk
@@ -3,6 +3,7 @@ VERSION = 0.1
## Customize below to fit your system
ARCHS = z80 i386-sysv amd64-sysv qbe
+SYSS = linux openbsd
# default architecure used in nested makefiles
ARCH = qbe
SYS = linux
diff --git a/crt/Makefile b/crt/Makefile
@@ -0,0 +1,11 @@
+.POSIX:
+
+include ../config.mk
+
+all: crt-$(ARCH)-$(SYS).o
+
+crt-$(ARCH)-$(SYS).o: $(ARCH)-$(SYS)/crt.o
+ ln -f $(ARCH)-$(SYS)/crt.o $@
+
+clean:
+ rm -f */crt.o crt-*.o