summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2016-12-20 09:35:09 +0100
committerPaweł Redman <pawel.redman@gmail.com>2016-12-20 09:35:09 +0100
commit337247d56e3300d17301daa7fa3fbfb6084cd540 (patch)
tree3299b79b08ff2112c21f6a3d1b33ff18ce88f2f5 /Makefile
Initial commit.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 39 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..441c008
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+CC = gcc
+CFLAGS += -g -Wall
+CPPFLAGS += -MMD
+LDFLAGS +=
+
+PP_BOLD := $(shell tput bold)
+PP_RESET := $(shell tput sgr0)
+PP_CC := $(PP_BOLD)$(shell tput setf 6)CC$(PP_RESET)
+PP_LD := $(PP_BOLD)$(shell tput setf 2)LD$(PP_RESET)
+PP_RM := $(PP_BOLD)$(shell tput setf 4)RM$(PP_RESET)
+
+SRC := src/common.c \
+ src/lexer.c \
+ src/main.c \
+ src/mapcat.c
+OBJ := $(SRC:src/%.c=obj/%.o)
+OUT := mapcat
+
+all: $(OUT)
+
+-include $(OBJ:.o=.d)
+
+obj/%.o : src/%.c
+ @echo "$(PP_CC) src/$*.c"
+ @mkdir -p $(@D)
+ @$(CC) $(CFLAGS) $(CPPFLAGS) -c src/$*.c -o obj/$*.o
+
+$(OUT): $(OBJ)
+ @echo "$(PP_LD) $(OUT)"
+ @$(CC) $(OBJ) -o $(OUT) $(LDFLAGS)
+
+clean:
+ @echo "${PP_RM} obj"
+ @rm -rf obj
+ @echo "${PP_RM} ${OUT}"
+ @rm -rf ${OUT}
+
+.PHONY: clean
+