Debian Codegraph @

munit/Makefile

raw
1 # Using µnit is very simple; just include the header and add the C
2 # file to your sources. That said, here is a simple Makefile to build
3 # the example.
4
5 CSTD:=99
6 OPENMP:=n
7 ASAN:=n
8 UBSAN:=n
9 EXTENSION:=
10 TEST_ENV:=
11 CFLAGS:=
12 AGGRESSIVE_WARNINGS=n
13
14 ifeq ($(CC),pgcc)
15 CFLAGS+=-c$(CSTD)
16 else
17 CFLAGS+=-std=c$(CSTD)
18 endif
19
20 ifeq ($(OPENMP),y)
21 ifeq ($(CC),pgcc)
22 CFLAGS+=-mp
23 else
24 CFLAGS+=-fopenmp
25 endif
26 endif
27
28 ifneq ($(SANITIZER),)
29 CFLAGS+=-fsanitize=$(SANITIZER)
30 endif
31
32 ifneq ($(CC),pgcc)
33 ifeq ($(EXTRA_WARNINGS),y)
34 CFLAGS+=-Wall -Wextra -Werror
35 endif
36
37 ifeq ($(ASAN),y)
38 CFLAGS+=-fsanitize=address
39 endif
40
41 ifeq ($(UBSAN),y)
42 CFLAGS+=-fsanitize=undefined
43 endif
44 endif
45
46 example$(EXTENSION): munit.h munit.c example.c
47 $(CC) $(CFLAGS) -o $@ munit.c example.c
48
49 test:
50 $(TEST_ENV) ./example$(EXTENSION)
51
52 clean:
53 rm -f example$(EXTENSION)
54
55 all: example$(EXTENSION)