From 823d499e4f57151b8ded478727b102b53941436f Mon Sep 17 00:00:00 2001 From: kartofen Date: Sun, 30 Apr 2023 17:39:21 +0300 Subject: like 350 lines total of scripts and makefile --- Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 64ec306..6254b9a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CC := gcc -ifeq (PROD,1) +ifeq ($(PROD),1) CFLAGS := -std=c99 -O2 # production flags else CFLAGS := -std=c99 -Wall -Wextra -Wpedantic -g -DDEBUG # debug flags @@ -49,12 +49,19 @@ $(DIRS): $(MAKE) $(BIND)/$(if $(TARGET),$(TARGET),$@) SUBD=$@ $(DEPD) $(TSTD): $(DEPD) - $(MAKE) $(BIND)/$@/ SUBD=$@ + $(MAKE) $(BIND)/$@/ SUBD=$@ SINGLE_OBJ=1 +ifeq ($(SINGLE_OBJ),1) +# generic single object build +$(BIND)/%: $(OBJD)/%.o + mkdir -p $(dir $@) + $(CC) $(CFLAGS) $(SFLAGS) $^ -o $@ +else # generic build $(BIND)/%: $(COBJS) mkdir -p $(dir $@) $(CC) $(CFLAGS) $(SFLAGS) $^ -o $@ +endif # generic compile to obj $(OBJD)/%.o: $(SRCD)/%.c @@ -77,7 +84,7 @@ $(BIND)/%.ko: $(FILES) # VM things vm: vm.sh $(BIND)/$(INITFS_NAME) $(BIND)/$(KERNEL_NAME) ./vm.sh run -$(BIND)/$(INITFS_NAME): $(SRCD)/initramfs-init.sh module tests +$(BIND)/$(INITFS_NAME): $(SRCD)/initramfs-init.sh module $(TSTD) ./vm.sh initramfs $@ $< $(BIND)/$(KERNEL_NAME): ./vm.sh kernel $@ -- cgit v1.2.3