-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (31 loc) · 826 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
BINARY = subnet
INSTALLDIR = /usr/local/bin
CODEDIRS = src
INCDIRS = include
CC = gcc
OPT = -O0
DEPFLAGS = -MP -MD
INCLIBS = -lm
CFLAGS = -Wall -Wextra -g $(foreach D, $(INCDIRS), -I$(D)) $(OPT) $(DEPFLAGS)
CFILES = $(foreach D, $(CODEDIRS), $(wildcard $(D)/*.c))
OBJECTS = $(patsubst %.c, %.o, $(CFILES))
DEPFILES = $(patsubst %.c, %.d, $(CFILES))
all: $(BINARY)
@./tests_py/test.py
$(BINARY): $(OBJECTS)
$(CC) -o $@ $^ $(INCLIBS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
test: $(BINARY)
@echo "Testing invalid inputs"
@./tests_py/test.py
@echo "Testing for memory leaks with valgrind"
@echo "This may take some time"
@./tests_py/valgrind_test.py
clean:
rm -rf $(BINARY) $(OBJECTS) $(DEPFILES)
install: $(BINARY)
install -m 755 $(BINARY) $(INSTALLDIR)
uninstall:
rm $(INSTALLDIR)/$(BINARY)
-include $(DEPFILES)