aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 07ac30929d1841b5b4b7dc643f5ac85922b64bb8 (plain)
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
# See LICENSE file for copyright and license details.

include config.mk



dist: static shared

static:
	@make OPT='-O2 -pipe -Werror' ${LIBNAME:=.a}
	rm -f ${OBJ}

shared:
	@make OPT='-O2 -pipe -Werror -fPIC' ${LIBNAME:=.so}
	rm -f ${OBJ}

debug:
	@make OPT=-g all

${LIBNAME:=.so}: ${OBJ}
	${CC} ${LDFLAGS} -shared ${OBJ} -o $@

${LIBNAME:=.a}: ${OBJ}
	ar rcs $@ ${OBJ}

.c.o:
	${CC} ${CFLAGS} -c $< -o $@

clean:
	rm -f ${OBJ} ${LIBNAME}.* *.core
	cd test && make clean

tests: dist
	cd test && make clean tests

install: dist
	cp src/log.h ${PREFIX}/include/log.h
	mkdir -p ${PREFIX}/lib/log
	cp ${LIBNAME:=.so} ${PREFIX}/lib/log/${LIBNAME:=.so}
	cp ${LIBNAME:=.a} ${PREFIX}/lib/log/${LIBNAME:=.a}

uninstall:
	rm -f ${PREFIX}/include/log.h
	rm -rf ${PREFIX}/lib/log