diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2021-11-08 17:44:18 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2021-11-08 17:44:18 +0300 |
commit | 6b35ae81a38573dcc42a944ebd8c2e6317cf5ad3 (patch) | |
tree | d9118b0db831d878db8acd33f7a69a0dbbf96849 /Makefile | |
parent | dc6d7befaa0de08814d4aaf85838faaf3fec8671 (diff) | |
download | parcini-master.tar.gz parcini-master.zip |
on sections shorter than 3 chars.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 47 |
1 files changed, 24 insertions, 23 deletions
@@ -1,38 +1,39 @@ CC?=gcc -RM:=rm -rf -SRC_DIR:=src -OBJ_DIR:=obj +CFLAGS:=-std=c99 -O0 -g -Wall -DDEBUG + INC_DIRS=$(addprefix -iquote,include) -PARCINI_SOURCES:=$(wildcard $(SRC_DIR)/*.c) -PARCINI_OBJECTS:=$(PARCINI_SOURCES:%.c=$(OBJ_DIR)/%.o) -BUILD_DIR:=build +BUILDIR:=build +OBJDIR:=$(BUILDIR)/obj + +PARCINI_SRCS:=$(wildcard src/*.c) +PARCINI_OBJS:=$(PARCINI_SRCS:%.c=$(OBJDIR)/%.o) -test: CFLAGS := -std=c99 -O0 -g -Wall -DDEBUG -test: $(BUILD_DIR) tests/parcini +ifdef ASAN +CFLAGS+= -fsanitize=address -fno-omit-frame-pointer +endif -tests/%: $(OBJ_DIR)/src/tests/%.o $(PARCINI_OBJECTS) - $(CC) $(LDFLAGS) -o $(BUILD_DIR)/$@ $^ - $(BUILD_DIR)/$@ +test: +test: $(BUILDIR) tests/parcini + +tests/%: $(OBJDIR)/src/tests/%.o $(PARCINI_OBJS) + mkdir -p $(BUILDIR)/$(@D) + $(CC) $(CFLAGS) $(LDFLAGS) -o $(BUILDIR)/$@ $^ + $(BUILDIR)/$@ example: CFLAGS := -std=c99 -O2 -Wall -example: $(OBJ_DIR)/example/example.o $(PARCINI_OBJECTS) - $(CC) $(LDFLAGS) -o $(BUILD_DIR)/example/$@ $^ +example: $(OBJDIR)/example/example.o $(PARCINI_OBJS) + mkdir -p $(@D) + $(CC) $(LDFLAGS) -o $(BUILDIR)/example/$@ $^ -$(OBJ_DIR)/%.o: %.c +$(OBJDIR)/%.o: %.c + mkdir -p $(@D) $(CC) -c $(CFLAGS) $(INC_DIRS) -o $@ $< -$(BUILD_DIR): - mkdir -p $(BUILD_DIR)/tests - mkdir -p $(BUILD_DIR)/example - mkdir -p $(OBJ_DIR)/src/tests - mkdir -p $(OBJ_DIR)/example - clean: - $(RM) $(OBJ_DIR) - $(RM) $(BUILD_DIR) + rm -r $(BUILDIR) .PHONY: clean test -.PRECIOUS: $(OBJ_DIR)/tests/%.o $(OBJ_DIR)/%.o +.PRECIOUS: $(OBJDIR)/tests/%.o $(OBJDIR)/%.o |