diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2026-10-04 23:51:01 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2026-10-04 23:51:01 +0200 |
| commit | 28f36a2e69e13ee326d8bda50ad7a8df4e74d63a (patch) | |
| tree | fe286a78f05be9424ba632e1ff33f581906b283a /Makefile | |
| parent | 2ed7bfe9bffecb9b6f6111b727b593a72d7bbc15 (diff) | |
| download | librm-28f36a2e69e13ee326d8bda50ad7a8df4e74d63a.tar.gz librm-28f36a2e69e13ee326d8bda50ad7a8df4e74d63a.zip | |
Saving done
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -5,6 +5,7 @@ SRCDIR ?= src INCDIR ?= inc OBJDIR ?= obj TSTDIR ?= test +TSTLIBDIR ?= test_lib INCS = -Ithirdparty/cglm/include -Ithirdparty/ -I/usr/include/json-c -I$(SRCDIR)/ LIBS = -lcurl -luuid -ljson-c @@ -20,17 +21,22 @@ APP_SOURCES = $(filter-out $(APP_MAIN_SOURCES),$(shell find $(SRCDIR) -name "*.c APP_OBJS = $(APP_SOURCES:%.c=$(OBJDIR)/%.o) APP_DEPS = $(APP_OBJS:%.o=%.d) +TST_LIB_SOURCES = $(shell find $(TSTLIBDIR) -name "*.c") +TST_LIB_OBJS = $(TST_LIB_SOURCES:%.c=$(OBJDIR)/%.o) +TST_LIB_DEPS = $(TST_LIB_OBJS:%.o=%.d) +TST_LIB_INCS = -I$(TSTLIBDIR)/ + TST_SOURCES = $(shell find $(TSTDIR) -name "*.c") TST_OBJS = $(TST_SOURCES:%.c=$(OBJDIR)/%.o) TST_DEPS = $(TST_OBJS:%.o=%.d) TST_APPS = $(TST_SOURCES:%.c=$(OBJDIR)/%) --include $(APP_DEPS) $(APP_MAIN_DEPS) $(TST_DEPS) +-include $(APP_DEPS) $(APP_MAIN_DEPS) $(TST_DEPS) $(TST_LIB_DEPS) # We don't really need to run the tests for bear to record them compile_commands.json: clean Makefile $(APP_SOURCES) @rm -f "$@" - bear -- make main + bear -- make main test main: $(APP_MAIN_OBJS) $(APP_OBJS) $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(APP_MAIN_OBJS) $(APP_OBJS) $(LIBS) @@ -39,9 +45,13 @@ $(OBJDIR)/%.o: %.c @mkdir -p $(dir $@) $(CC) $(CFLAGS) $(INCS) -MMD -o $@ -c $< -$(OBJDIR)/test/%: $(OBJDIR)/test/%.o $(APP_OBJS) +$(OBJDIR)/test/%.o: test/%.c + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) $(INCS) $(TST_LIB_INCS) -MMD -o $@ -c $< + +$(OBJDIR)/test/%: $(OBJDIR)/test/%.o $(TST_LIB_OBJS) $(APP_OBJS) @mkdir -p $(dir $@) - $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(APP_OBJS) $(LIBS) + $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(TST_LIB_OBJS) $(APP_OBJS) $(LIBS) clean: @rm -rf $(OBJDIR) |
