-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (43 loc) · 1.49 KB
/
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
OBJECTS=algorithms.o layout.o utils.o color.o
CFLAGS=-D_GNU_SOURCE -g -Wall -Werror -O3 -std=c11
LDFLAGS= -lm -lcgraph -lcairo
GITSHA=$(shell git rev-parse HEAD)
GITDIRTY=$(shell git status --porcelain 2> /dev/null)
CC=gcc
all: assemble grid gravity maze paths print png color scad
.PHONY: all
clean:
-rm tests *.o
.PHONY: clean
# Tools
assemble: main_assemble.o $(OBJECTS)
$(CC) $(CFLAGS) main_assemble.o $(OBJECTS) -o $@ $(LDFLAGS)
color: main_color.o $(OBJECTS)
$(CC) $(CFLAGS) main_color.o $(OBJECTS) -o $@ $(LDFLAGS)
png: main_png.o $(OBJECTS)
$(CC) $(CFLAGS) main_png.o $(OBJECTS) -o $@ $(LDFLAGS)
scad: main_scad.o $(OBJECTS)
$(CC) $(CFLAGS) main_scad.o $(OBJECTS) -o $@ $(LDFLAGS)
paths: main_paths.o $(OBJECTS)
$(CC) $(CFLAGS) main_paths.o $(OBJECTS) -o $@ $(LDFLAGS)
print: main_print.o $(OBJECTS)
$(CC) $(CFLAGS) main_print.o $(OBJECTS) -o $@ $(LDFLAGS)
maze: main_maze.o $(OBJECTS)
$(CC) $(CFLAGS) main_maze.o $(OBJECTS) -o $@ $(LDFLAGS)
gravity: main_gravity.o $(OBJECTS)
$(CC) $(CFLAGS) main_gravity.o $(OBJECTS) -o $@ $(LDFLAGS)
grid: main_grid.o $(OBJECTS)
$(CC) $(CFLAGS) main_grid.o $(OBJECTS) -o $@ $(LDFLAGS)
# Goofball service
container: all
docker build -t mazes-c .
.PHONY: container
# Tests
run-tests: all tests
./tests
.PHONY: run-tests
tests: tests.o $(OBJECTS)
$(CC) $(CFLAGS) tests.o $(OBJECTS) -o $@ $(LDFLAGS) -lglib-2.0
.PHONY: tests
tests.o: tests.c
$(CC) -c $(CFLAGS) -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include $(CPPFLAGS) -o $@ $<