diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8917d8e --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +CC?=gcc +RM:=rm -rf + +SRC_DIR:=src +OBJ_DIR:=obj +INC_DIRS=$(addprefix -iquote,include) + +PARCINI_SOURCES:=$(wildcard $(SRC_DIR)/*.c) +PARCINI_OBJECTS:=$(PARCINI_SOURCES:%.c=$(OBJ_DIR)/%.o) +BUILD_DIR:=build + +test: CFLAGS := -std=c99 -O0 -g -Wall -DDEBUG +test: $(BUILD_DIR) tests/parcini + +tests/%: $(OBJ_DIR)/src/tests/%.o $(OBJ_DIR)/src/%.o $(PARCINI_OBJECTS) + $(CC) $(LDFLAGS) -o $(BUILD_DIR)/$@ $^ + $(BUILD_DIR)/$@ + +$(OBJ_DIR)/%.o: %.c + $(CC) -c $(CFLAGS) $(INC_DIRS) -o $@ $< + +$(BUILD_DIR): + mkdir -p $(BUILD_DIR)/tests + mkdir -p $(OBJ_DIR)/src/tests + +clean: + $(RM) $(OBJ_DIR) + $(RM) $(BUILD_DIR) + +.PHONY: clean test + +.PRECIOUS: $(OBJ_DIR)/tests/%.o $(OBJ_DIR)/%.o |