aboutsummaryrefslogtreecommitdiffstats
path: root/sw/Makefile
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-08-16 13:01:15 -0230
committerSam Anthony <sam@samanthony.xyz>2025-08-16 13:01:15 -0230
commit478a91bd82e27d8d6b2e597fd659e484ca6b205a (patch)
tree05c58d2018059cbf9b60baeb26409f4df97358eb /sw/Makefile
parenta8a68e5e77cac2fedb03a164acc666ccc1a1a8b1 (diff)
downloadcan-gauge-interface-478a91bd82e27d8d6b2e597fd659e484ca6b205a.zip
add systests to makefile
Diffstat (limited to 'sw/Makefile')
-rw-r--r--sw/Makefile22
1 files changed, 18 insertions, 4 deletions
diff --git a/sw/Makefile b/sw/Makefile
index 36538cb..b4b0ae9 100644
--- a/sw/Makefile
+++ b/sw/Makefile
@@ -3,22 +3,36 @@ INCLUDES = -I./ -I/home/sam/prog/mla/v2018_11_26/framework/usb/inc
CFLAGS = -mcpu=pic16f1459 -std=c99 $(INCLUDES) -Wall
LDFLAGS =
+SYSTEST_DIR = tests/system
+
OUT = can_gauge
-SRC = $(wildcard *.c)
+SRC = $(shell find . -name "*.c" ! -name "main.c" -maxdepth 1)
HDR = $(wildcard *.h)
-HEX = $(OUT).hex
OBJ = $(SRC:.c=.p1)
+HEX = $(OUT).hex
-$(HEX): $(OBJ)
+SYSTEST_SRC = $(wildcard $(SYSTEST_DIR)/*.c)
+SYSTEST_OBJ = $(notdir $(SYSTEST_SRC:.c=.p1))
+SYSTEST_HEX = $(SYSTEST_OBJ:.p1=.hex)
+
+$(HEX): $(OBJ) main.p1
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
%.p1: %.c
$(CC) $(CFLAGS) -c $<
+$(SYSTEST_HEX): %.hex: %.p1 $(OBJ)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+$(SYSTEST_OBJ): %.p1: $(SYSTEST_DIR)/%.c
+ $(CC) $(CFLAGS) -c $<
+
clean:
rm -f $(OBJ) $(HEX) *.d *.p1 *.lst *.rlf *.o *.s *.sdb *.sym *.hxl *.elf *.cmf
+systest: $(SYSTEST_HEX)
+
$(OBJ): $(HDR)
-.PHONY: clean
+.PHONY: clean systest