-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
executable file
·47 lines (39 loc) · 1.56 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
PREFIX= /usr/local/
AWK= /usr/bin/awk
RUNAWK= runawklite
WARNINGS= -Wall -Wextra -std=gnu99 -pedantic \
-Wpointer-arith -Wcast-qual -Wcast-align -Wstrict-overflow=4 \
-Waggregate-return -Wbad-function-cast \
-Wswitch-default -Wswitch-enum \
-Wwrite-strings -Wformat=2 \
-Wshadow -Wuninitialized -Winit-self \
-Wstrict-prototypes -Wold-style-definition \
-Werror-implicit-function-declaration \
-Wredundant-decls \
-Wnested-externs \
-Wundef -Wmissing-include-dirs \
-Wno-unused-function
ifdef STRICT
WARNINGS+= -Wconversion -Wmissing-prototypes -Wmissing-declarations \
-Wunreachable-code -Wunused-function -Wfloat-equal
endif
CFLAGS= -O ${WARNINGS} ${CPPFLAGS}
all: runawk
runawk:
ifeq (${AWK},/bin/busybox)
${CC} -o runawk -D'AWK="${AWK}"' -D'AWK2="awk"' ${CFLAGS} runawk.c
else
${CC} -o runawk -D'AWK="${AWK}"' ${CFLAGS} runawk.c
endif
install: all
install -d -m755 "${DESTDIR}${PREFIX}/bin"
install -d -m755 "${DESTDIR}${PREFIX}/share/awkenough/utils"
install -m755 runawk "${DESTDIR}${PREFIX}/bin/${RUNAWK}"
install -m644 library.awk "${DESTDIR}${PREFIX}/share/awkenough/library.awk"
cd utils && for f in *; do \
sed -e "1 s@#!/[a-z/]*/runawk -f /[a-z/]*/library.awk@#!${PREFIX}/bin/${RUNAWK} -f ${PREFIX}/share/awkenough/library.awk@" "$$f" > "../$$f.new"; \
install -m644 "../$$f.new" "${DESTDIR}${PREFIX}/share/awkenough/utils/$$f"; \
if [ ! -e "${PREFIX}/bin/$$f" ]; then ln -s "${PREFIX}/share/awkenough/utils/$$f" "${DESTDIR}${PREFIX}/bin/$$f"; fi; \
done
clean:
rm -f *.new runawk