summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 13 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 611ea8d..708443e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,24 @@
CC = gcc
-INCFLAGS = -Isrc
+SOURCE = src
-CCFLAGS = -std=c99 -Wall -Wextra -pedantic -O2 -D_DEFAULT_SOURCE
+MAJOR = 0
+MINOR = 0
+PATCH = 1
+
+INCFLAGS = $(shell echo $(SOURCE) | xargs printf -- '-I%s')
+
+CCFLAGS = -std=c99 -Wall -Wextra -pedantic -O2
+CCFLAGS += -D_DEFAULT_SOURCE -DMAJOR=$(MAJOR) -DMINOR=$(MINOR) -DPATCH=$(PATCH) -DCHECK_LINK
CCFLAGS += $(INCFLAGS)
+LDFLAGS = -s
LDFLAGS += $(INCFLAGS)
BIN = bin
APP = $(BIN)/app
-SRC = $(shell find src -name "*.c")
+SRC = $(shell find $(SOURCE) -name "*.c")
+DIR = $(shell find $(SOURCE) -type d)
OBJ = $(SRC:%.c=$(BIN)/%.o)
.PHONY: dirs run clean build install uninstall
@@ -17,10 +26,7 @@ OBJ = $(SRC:%.c=$(BIN)/%.o)
EOF: clean build
dirs:
- mkdir -p ./$(BIN)
- mkdir -p ./$(BIN)/src
- mkdir -p ./$(BIN)/src/util
- mkdir -p ./$(BIN)/src/commands
+ echo $(DIR) | xargs printf -- '$(BIN)/%s\n' | xargs mkdir -p
run: build
$(APP)