-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (56 loc) · 1.61 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
TARGET = th
# Set implicit variables (info make -n implicit\ variables)
PREFIX ?= /usr/local
CFLAGS = -Wall -Werror -std=c99 -pedantic -ggdb
LDFLAGS =
LDLIBS =
SRC = src
# Set installation location variables
DB_NAME = thesaurus
DB_HOME = /var/local/lib/th
ETC_TARGET = /etc/th.conf
MODULES != ls -1 ${SRC}/*.c | sed 's/\.c/.o/g'
# Default rule:
all: Confirm_DB5 Confirm_Readargs CP_Prepare_Sources ${TARGET} # ${DB_NAME}.db
@echo Finished generating ${TARGET}
include make.d/make_static_readargs.mk
CFLAGS += ${RA_INC}
LDLIBS += ${RA_LINK}
CP_NAMES = get_keypress prompter columnize read_file_lines commaize
include make.d/make_c_patterns.mk
MODULES += ${CP_OBJECTS}
# Remove duplicates:
MODULES != echo ${MODULES} | xargs -n1 | sort -u | xargs
include make.d/make_db5.mk
CFLAGS += ${DB5_INC}
LDLIBS += ${DB5_LINK}
${TARGET} : ${MODULES}
${CC} -o $@ ${MODULES} ${LDFLAGS} ${LDLIBS}
%.o: %.c
${CC} ${CFLAGS} -c -o $@ $<
install: ${DB_NAME}.db
install -d ${DB_HOME}
install -D --mode=744 ${DB_NAME}.* ${DB_HOME}
install -D --mode=755 ${TARGET} ${PREFIX}/bin
env echo -e ${DB_HOME}/${DB_NAME} > ${ETC_TARGET}
uninstall:
rm -f ${ETC_TARGET}
rm -f ${PREFIX}/bin/${TARGET}
rm -rf ${DB_HOME}
clean:
rm -f ${TARGET}
rm -rf ${SRC}/*.o
full_clean:
rm -f ${TARGET}
rm -rf ${SRC}/*.o
rm -rf ${CP_SOURCES}
rm -rf ${CP_HEADERS}
# ${DB_NAME}.db: files/mthesaur.txt
thesaurus.db: files/mthesaur.txt
@echo "Importing Moby Thesaurus"
./th -Tv
files/mthesaur.txt:
@echo "Downloading Moby Thesaurus"
install -d files
wget -nc -P files ftp://ftp.ibiblio.org/pub/docs/books/gutenberg/3/2/0/3202/files.zip
unzip -n files/files.zip