aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 10 insertions, 3 deletions
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 $@