aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-08-18 04:54:45 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-08-18 04:54:45 +0300
commit544100da719843438372c6e30739bf9b5d3ebb9c (patch)
tree00894be08c33d97dd0873052d01609f5a78c2a54 /Makefile
downloadparcini-544100da719843438372c6e30739bf9b5d3ebb9c.tar.gz
parcini-544100da719843438372c6e30739bf9b5d3ebb9c.zip
Init
Basically functional.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
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