-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (43 loc) · 1.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
.PHONY: clean run
ifeq (${DEBUG}, 1)
CFLAGS += -DDEBUG -O0 -ggdb -fno-inline
WRAP := valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all
else
CFLAGS += -O3
endif
LIBFLAGS := $$(pkgconf --cflags ncurses readline sqlite3)
CFLAGS += -std=c2x -I./source/ -I./object/ -I./ ${LIBFLAGS}
CFLAGS += -Wall -Wextra -Wpedantic
LDLIBS += $$(pkgconf --libs ncurses readline sqlite3)
OBJECT.d:=object/
SOURCE.d:=source/
SOURCE:=argument_yy.tab.c bash_history.yy.c main.c cli.c tui.c storage.c
OBJECT:=$(addprefix ${OBJECT.d},$(addsuffix .o,$(basename ${SOURCE})))
SOURCE:=$(addprefix ${SOURCE.d},${SOURCE})
OUTPUT:=histui
${OUTPUT}: ${OBJECT}
${LINK.c} -o ${OUTPUT} ${OBJECT} ${LDLIBS}
object/%.yy.c: source/%.l
flex --prefix=$*_ --header-file=$(basename $@).h -o $@ $<
object/%.tab.c: source/%.y
bison --name-prefix=$*_ --header=$(basename $@).h -o $@ $<
object/%.o: object/%.l.c
${COMPILE.c} $< -o $@
object/%.o: source/%.c
${COMPILE.c} $< -o $@
clean:
-${RM} ${OBJECT.d}/*
-${RM} ./${OUTPUT}
test:
${WRAP} ./${OUTPUT}
docs:
kramdown-man documentation/histui.1.md -o ${OBJECT.d}/histui.1
install:
-cp ${OBJECT.d}/histui.1 /usr/local/share/man/man1/
cp ${OUTPUT} ~/bin/
help:
@echo Available targets:
@echo " histui"
@echo " docs"
@echo " install"
@echo " clean"