summaryrefslogtreecommitdiff
path: root/test/Makefile
blob: 572e6044462c0fdf275ed8ea21ba7502c23c678a (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
45
46
47
48
49
50
51
52
CC = gcc

CFLAGS = -std=gnu99 -Wall -DFAKE_STAT -Werror -Wextra $(FAKETIME_COMPILE_CFLAGS)
LDFLAGS = -lrt -lpthread

SRC = timetest.c
OBJ = ${SRC:.c=.o}

all: timetest test

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

timetest: ${OBJ}
	${CC} -o $@ ${OBJ} ${LDFLAGS}

test: timetest functest
	@echo
	@./test.sh

# run functional tests
functest:
	./testframe.sh functests

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

randomtest: getrandom_test use_lib_random librandom.so repeat_random getentropy_test
	./randomtest.sh

getpidtest: use_lib_getpid libgetpid.so
	./pidtest.sh

syscalltest: syscall_test
	./syscalltest.sh

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

lib%.so: lib%.o
	${CC} -o $@ -shared ${CFLAGS} $<

use_lib_%: use_lib_%.c lib%.so
	${CC} -L. -o $@ ${CFLAGS}  $< -l$*

clean:
	@rm -f ${OBJ} timetest getrandom_test lib*.o lib*.so use_lib_random use_lib_getpid

distclean: clean
	@echo

.PHONY: all test clean distclean randomtest