From 06f60ae1b3c7d11092a5433186360fcbb1221309 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Tue, 21 Apr 2020 10:43:02 -0700 Subject: chore: updated make rules to not link all made libraries --- .gitignore | 1 + Makefile | 7 ++++--- sys/libn/rules.mk | 1 + sys/libn/test.c | 14 +++++++------- sys/rules.mk | 6 ------ 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 8a7f852..43e0b14 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ lib/ dep/ build/ vendor/ +sys/cc diff --git a/Makefile b/Makefile index 344b88b..13e8c14 100644 --- a/Makefile +++ b/Makefile @@ -11,14 +11,15 @@ LIB_DIR := lib OBJ_DIR := build # Flags, Libraries and Includes -INCS := -I$(INC_DIR) CFLAGS := -g -fno-strict-aliasing -fwrapv -fms-extensions AFLAGS := -f elf64 +INCS := -I$(INC_DIR) +ELIBS := # Named generic rules (must be evaluated lazily) COMPILE = $(CC) -MMD $(CFLAGS) $(TCFLAGS) $(INCS) $(TCINCS) -o $@ -c $< -LINK = $(CC) -MMD $(CFLAGS) $(TCFLAGS) -o $@ $^ $(LIBS) $(TCLIBS) -COMPLINK = $(CC) -MMD $(CFLAGS) $(TCFLAGS) $(INCS) $(TCINCS) -o $@ $^ $(LIBS) $(TCLIBS) +LINK = $(CC) -MMD $(CFLAGS) $(TCFLAGS) -o $@ $^ $(ELIBS) $(TCLIBS) +COMPLINK = $(CC) -MMD $(CFLAGS) $(TCFLAGS) $(INCS) $(TCINCS) -o $@ $^ $(ELIBS) $(TCLIBS) ASSEMBLE = $(AS) $(AFLAGS) $(TCFLAGS) -o $@ $< ARCHIVE = $(AR) crs $@ $^ diff --git a/sys/libn/rules.mk b/sys/libn/rules.mk index 4e33971..da2e993 100644 --- a/sys/libn/rules.mk +++ b/sys/libn/rules.mk @@ -36,6 +36,7 @@ BINS := $(BINS) $(BINS_$(d)) $(LIBS_$(d)): $(OBJS_$(d)) $(ARCHIVE) +$(BINS_$(d)): TCLIBS := $(LIBS_$(d)) $(BINS_$(d)): $(OBJ_DIR)/libn/test.o $(LINK) diff --git a/sys/libn/test.c b/sys/libn/test.c index 9d5eb81..3f97453 100644 --- a/sys/libn/test.c +++ b/sys/libn/test.c @@ -2,7 +2,7 @@ #include uintptr -printtest(coro *c, uintptr d) +printtest(Coro *c, uintptr d) { printf("--> Recieved %lu\n", d); d = coro·yield(c, d+10); @@ -12,7 +12,7 @@ printtest(coro *c, uintptr d) } uintptr -sequence(coro *c, uintptr start) +sequence(Coro *c, uintptr start) { int d = start; for (;;) { @@ -24,15 +24,15 @@ sequence(coro *c, uintptr start) struct PrimeMsg { - coro *seq; + Coro *seq; int p; }; uintptr -filter(coro *c, uintptr data) +filter(Coro *c, uintptr data) { int x, p; - coro *seq; + Coro *seq; struct PrimeMsg *msg; // Need to copy relevant variables onto the local stack @@ -55,7 +55,7 @@ int main() { int i; - coro *c[4]; + Coro *c[4]; uintptr d; printf("Starting singleton test\n"); @@ -86,7 +86,7 @@ main() /* Prime sieve */ printf("Starting prime test\n"); uintptr num; - coro *cur, *seq[50]; + Coro *cur, *seq[50]; num = 2; seq[0] = coro·new(4096, &sequence); diff --git a/sys/rules.mk b/sys/rules.mk index 90a2d96..362edcd 100644 --- a/sys/rules.mk +++ b/sys/rules.mk @@ -10,12 +10,6 @@ include $(DIR)/rules.mk DIR := $(d)/libn include $(DIR)/rules.mk -DIR := $(d)/cc -include $(DIR)/rules.mk - -DIR := $(d)/nixos -include $(DIR)/rules.mk - # ---- Pop off stack ---- -include $(DEPS_$(d)) -- cgit v1.2.1