aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 8102aec68961f8bf3d1e53f174f147064d98090a (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
CC = gcc
CFLAGS = -Isrc $$(ncursesw5-config --cflags)
LIBS = $$(ncursesw5-config --libs)
#LIBS = -lncursesw

PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man

all: bin/maze

debug: CFLAGS += -Wall -DEBUG -g
debug: bin/maze

app_sources = $(wildcard src/*.c src/game/*.c)
app_objects = $(patsubst src/%.c, bin/%.o, $(app_sources))

bin/maze: $(app_objects)
	$(CC) $(CFLAGS) $^ -o $@ $(LIBS)

bin/main.o: src/main.c bin
	$(CC) $(CFLAGS) -c $< -o $@

bin/args.o: src/args.c bin
	$(CC) $(CFLAGS) -c $< -o $@

bin/config.o: src/config.c bin
	$(CC) $(CFLAGS) -c $< -o $@

bin/color.o: src/color.c bin
	$(CC) $(CFLAGS) -c $< -o $@

bin/menu.o: src/menu.c bin
	$(CC) $(CFLAGS) -c $< -o $@

bin/game/entry.o: src/game/entry.c bin/game
	$(CC) $(CFLAGS) -c $< -o $@

bin/game/game.o: src/game/game.c bin/game
	$(CC) $(CFLAGS) -c $< -o $@

bin/game/operations.o: src/game/operations.c bin/game
	$(CC) $(CFLAGS) -c $< -o $@

bin/game/commands.o: src/game/commands.c bin/game
	$(CC) $(CFLAGS) -c $< -o $@

bin/file.o: src/file.c bin
	$(CC) $(CFLAGS) -c $< -o $@

bin/maze_generator.o: src/maze_generator.c bin
	$(CC) $(CFLAGS) -c $< -o $@

bin/maze_solver.o: src/maze_solver.c bin
	$(CC) $(CFLAGS) -c $< -o $@

bin/utilities.o: src/utilities.c bin
	$(CC) $(CFLAGS) -c $< -o $@

bin:
	mkdir -p $@

bin/game:
	mkdir -p $@

clean:
	rm -rf bin/*

install: bin/maze
	@echo INSTALL execuatble
	mkdir -p $(PREFIX)/bin
	cp $< $(PREFIX)/bin/maze
	chmod 755 $(PREFIX)/bin/maze
	@echo INSTALL man page
	gzip -c doc/maze.1  > $(MANPREFIX)/man1/maze.1.gz
	chmod 644 $(MANPREFIX)/man1/maze.1.gz

uninstall:
	@echo REMOVE execuatble
	rm -f $(PREFIX)/bin/maze
	@echo REMOVE man page
	rm -f $(MANPREFIX)/man1/maze.1.gz

.PHONY: clean install uninstall