-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (29 loc) · 991 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
CC=gcc
CFLAGS=-Wall -Wextra
LDFLAGS=-lncurses -ltinfo
GAME_OBJS=obj/game/main.o obj/game/sudoku.o obj/game/interface.o obj/game/misc.o
GAME_BIN=sudoku.out
SOLVER_OBJS=obj/solver/main.o obj/solver/sudoku.o obj/solver/misc.o
SOLVER_BIN=solver.out
#-------------------------------------------------------------------------------
.PHONY: all run clean
all: $(GAME_BIN) $(SOLVER_BIN)
run: $(GAME_BIN)
./$<
clean:
rm -f $(SOLVER_BIN) $(GAME_BIN)
rm -f $(GAME_OBJS) $(SOLVER_OBJS)
#-------------------------------------------------------------------------------
# Game
$(GAME_BIN): $(GAME_OBJS)
@mkdir -p $(dir $@)
$(CC) -o $@ $(GAME_OBJS) $(LDFLAGS)
$(GAME_OBJS): obj/game/%.o : src/game/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c -o $@ $< $(LDFLAGS)
#-------------------------------------------------------------------------------
# Solver
$(SOLVER_BIN): $(SOLVER_OBJS)
$(CC) -o $@ $(SOLVER_OBJS)
$(SOLVER_OBJS): obj/solver/%.o : src/solver/%.c
$(CC) $(CFLAGS) -c -o $@ $<