summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-03-06 21:54:50 -0500
committerJakob Kaivo <jkk@ung.org>2019-03-06 21:54:50 -0500
commitff0c6b0b2dfa2620518cd42e5187430bb50df6f1 (patch)
treef3f834a5b7d630491a11ba537d89a8016d91abf1
parent378346c9208718221779607ed74351888d0f695b (diff)
add architecture specific stuff into base library
-rw-r--r--.deps.mk8
-rw-r--r--.deps/libc.C_03
-rw-r--r--mk.sh14
3 files changed, 21 insertions, 4 deletions
diff --git a/.deps.mk b/.deps.mk
index c31a96ff..38bffca2 100644
--- a/.deps.mk
+++ b/.deps.mk
@@ -2,6 +2,10 @@ include .config.mk
BASE_CFLAGS=-I$(INCDIR) -fno-builtin -nostdinc
+libc.a($(ARCHITECTURE)-$(WORDSIZE).o): $(OBJDIR)/$(ARCHITECTURE)-$(WORDSIZE).o
+$(OBJDIR)/$(ARCHITECTURE)-$(WORDSIZE).o: $(SRCDIR)/nonstd/$(ARCHITECTURE)-$(WORDSIZE).s
+ $(CC) $(BASE_CFLAGS) $(CFLAGS) -c $(SRCDIR)/nonstd/$(ARCHITECTURE)-$(WORDSIZE).s -o $@
+
libc.a(__libc_start.o): $(OBJDIR)/__libc_start.o
$(OBJDIR)/__libc_start.o: ./src/nonstd/__libc_start.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -c ./src/nonstd/__libc_start.c -o $@
@@ -22,6 +26,10 @@ libc.a(_XOPEN_SOURCE_EXTENDED.o): $(OBJDIR)/_XOPEN_SOURCE_EXTENDED.o
$(OBJDIR)/_XOPEN_SOURCE_EXTENDED.o: ./src/nonstd/_FTM/_XOPEN_SOURCE_EXTENDED.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -c ./src/nonstd/_FTM/_XOPEN_SOURCE_EXTENDED.c -o $@
+libc.a(crt1.o): $(OBJDIR)/crt1.o
+$(OBJDIR)/crt1.o: ./src/nonstd/crt/crt1.c
+ $(CC) $(BASE_CFLAGS) $(CFLAGS) -c ./src/nonstd/crt/crt1.c -o $@
+
libc.a(__syscall.o): $(OBJDIR)/__syscall.o
$(OBJDIR)/__syscall.o: ./src/nonstd/__syscall.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -c ./src/nonstd/__syscall.c -o $@
diff --git a/.deps/libc.C_0 b/.deps/libc.C_0
index 55a974e9..92b25824 100644
--- a/.deps/libc.C_0
+++ b/.deps/libc.C_0
@@ -1,5 +1,6 @@
.POSIX:
libc_C_0_OBJS= \
+ libc.a($(OBJDIR)/$(ARCHITECTURE)-$(WORDSIZE).o) \
libc.a($(OBJDIR)/__libc_start.o) \
libc.a($(OBJDIR)/__libc.o) \
libc.a($(OBJDIR)/_XOPEN_SOURCE.o) \
@@ -11,4 +12,4 @@ libc_C_0_OBJS= \
libc.a($(OBJDIR)/__stderr.o) \
libc.a($(OBJDIR)/__stdout.o) \
libc.a($(OBJDIR)/__stdin.o) \
- libc.a($(OBJDIR)/__assert.o) \ No newline at end of file
+ libc.a($(OBJDIR)/__assert.o)
diff --git a/mk.sh b/mk.sh
index 642d39ca..5789ee6c 100644
--- a/mk.sh
+++ b/mk.sh
@@ -167,9 +167,9 @@ make_headers_mk() {
for header in $(cat "${DEPS}/all.h"); do
printf 'Building dependencies for <%s>\n' "$header"
printf '$(INCDIR)/%s: mkh.sh ' "$header" >> "${TOPDIR}/.headers.mk"
- mkdir -p $(dirname "${TOPDIR}/.deps/${header}.deps")
- grep -l "#include <${header}>" $(cat "${DEPS}/all.c" "${DEPS}/all.ref") > "${TOPDIR}/.deps/${header}.deps"
- sed -e "s#${SRCDIR}#\$(SRCDIR)#" < "${TOPDIR}/.deps/${header}.deps" | tr '\n' ' ' >> "${TOPDIR}/.headers.mk"
+ mkdir -p $(dirname "${TOPDIR}/.deps/h/${header}.deps")
+ grep -l "#include <${header}>" $(cat "${DEPS}/all.c" "${DEPS}/all.ref") > "${TOPDIR}/.deps/h/${header}.deps"
+ sed -e "s#${SRCDIR}#\$(SRCDIR)#" < "${TOPDIR}/.deps/h/${header}.deps" | tr '\n' ' ' >> "${TOPDIR}/.headers.mk"
printf '\n\tINCDIR=$(INCDIR) sh mkh.sh $(INCDIR)/%s\n\n' "${header}" >> "${TOPDIR}/.headers.mk"
done
@@ -194,6 +194,14 @@ make_deps_mk() {
printf 'BASE_CFLAGS=-I$(INCDIR) -fno-builtin -nostdinc\n' >> "${TOPDIR}/.deps.mk"
printf '\n' >> "${TOPDIR}/.deps.mk"
+ printf 'libc.a($(ARCHITECTURE)-$(WORDSIZE).o): $(OBJDIR)/$(ARCHITECTURE)-$(WORDSIZE).o\n' >> "${TOPDIR}/.deps.mk"
+ printf '$(OBJDIR)/$(ARCHITECTURE)-$(WORDSIZE).o: $(SRCDIR)/nonstd/$(ARCHITECTURE)-$(WORDSIZE).s\n' >> "${TOPDIR}/.deps.mk"
+ printf '\t$(CC) $(BASE_CFLAGS) $(CFLAGS) -c $(SRCDIR)/nonstd/$(ARCHITECTURE)-$(WORDSIZE).s -o $@\n\n' >> "${TOPDIR}/.deps.mk"
+
+ # Make sure the architecture dependent stuff gets in
+ printf '.POSIX:\nlibc_C_0_OBJS= \\\n' > "${DEPS}/libc.C_0"
+ printf '\tlibc.a($(OBJDIR)/$(ARCHITECTURE)-$(WORDSIZE).o)' >> "${DEPS}/libc.C_0"
+
for file in $(cat "${DEPS}/all.c"); do
printf 'Building dependencies from %s\n' "$file"
type=$(classify_source "${file}")