-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
52 lines (39 loc) · 972 Bytes
/
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
47
48
49
50
51
52
# Copyright (c) 2019 Vicente Romero Calero. All rights reserved.
# Licensed under the MIT License.
# See LICENSE file in the project root for full license information.
TESTSDIR = tests
UNITTESTSDIR = tests/unit
CC = gcc
CFLAGS = -std=c99 -Wall -DNDEBUG -O3 -march=native -mtune=native
DEBUGFLAGS = -std=c99 -Wall -O0 -g3
LDFLAGS = -shared
AR = ar
SRC = $(wildcard *.c)
OBJ = $(SRC:.c=.o)
.PHONY: default
default: lib
.PHONY: all
all: lib test
.PHONY: debug
debug: CFLAGS = $(DEBUGFLAGS)
debug: all
%.o: %.c
${CC} -c $(CFLAGS) $<
libvtenc.a: $(OBJ)
$(AR) rcs $@ $^
libvtenc.so: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
.PHONY: lib
lib: libvtenc.a libvtenc.so
.PHONY: test
test: lib
$(MAKE) -C $(TESTSDIR) all CFLAGS="$(CFLAGS)"
$(MAKE) -C $(UNITTESTSDIR) all CFLAGS="$(CFLAGS)"
.PHONY: check
check: test
./$(UNITTESTSDIR)/unit_tests
.PHONY: clean
clean:
rm -f *.o libvtenc.a libvtenc.so
$(MAKE) -C $(TESTSDIR) clean
$(MAKE) -C $(UNITTESTSDIR) clean