Download Makefile source code

 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
APPNAME=$(shell basename $(shell pwd))
APPARGS=5 2 3 0 100 0 750

CC=cc
CXX=g++
CFLAGS=-g -std=gnu11 -Wall -Wextra
LIBS=-pthread
LINTFILTERS=$\
	-readability/casting,$\
	-build/header_guard,$\
	-build/include_subdir


$(APPNAME): main.o queue.o arguments.o simulation.o
	$(CC) $(CFLAGS) $^ -o $(APPNAME) $(LIBS)

%.o: %.c
	$(CC) -c $(CFLAGS) $< -o $@ $(LIBS)

all: $(APPNAME) lint memcheck helgrind

.PHONY: lint
lint:
	cpplint --filter=$(LINTFILTERS) *.h *.c

.PHONY: memcheck
memcheck:
	valgrind --tool=memcheck ./$(APPNAME) $(APPARGS)

.PHONY: helgrind
helgrind:
	valgrind --quiet --tool=helgrind ./$(APPNAME) $(APPARGS)

.PHONY: gitignore
gitignore:
	echo $(APPNAME) > .gitignore

.PHONY: clean
clean:
	rm -f $(APPNAME) *.o