-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (32 loc) · 1.03 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
CFLAGS = -std=c99 -Wall -Wextra -static -lm $(CFLAG)
CP ?= cp
TIME ?= time
PREFIX ?= /usr/local
SRCDIR = src
LIBDIR = lib
BINDIR = bin
OBJDIR = obj
TSTDIR = test
.PHONY: all test clean install uninstall
all: ${BINDIR}/praytimes
test: ${BINDIR}/lib-praytimes-test ${BINDIR}/lib-praytimes-math-test
${TIME} ${BINDIR}/lib-praytimes-math-test; \
${TIME} ${BINDIR}/lib-praytimes-test
clean:
${RM} -rf ${OBJDIR}/*
install: ${BINDIR}/praytimes
${CP} ${BINDIR}/praytimes ${PREFIX}/bin/
uninstall:
${RM} ${PREFIX}/bin/praytimes
${BINDIR}/praytimes: ${OBJDIR}/praytimes-src.o ${OBJDIR}/praytimes-lib.o
${CC} -o $@ $^ ${CFLAGS}
${BINDIR}/lib-praytimes-test: ${OBJDIR}/lib_praytimes-test.o ${OBJDIR}/praytimes-lib.o
${CC} -o $@ $^ ${CFLAGS}
${BINDIR}/lib-praytimes-math-test: ${OBJDIR}/lib_praytimes_math-test.o
${CC} -o $@ $^ ${CFLAGS}
${OBJDIR}/%-src.o: ${SRCDIR}/%.c
${CC} -o $@ -c -I${LIBDIR} $< ${CFLAGS}
${OBJDIR}/%-lib.o: ${LIBDIR}/%.c
${CC} -o $@ -c $< ${CFLAGS}
${OBJDIR}/%-test.o: ${TSTDIR}/%.c
${CC} -o $@ -c $< -I${LIBDIR} ${CFLAGS}