-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
63 lines (51 loc) · 1.87 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
VERSION = 1.3.1
CC ?= gcc
CFLAGS ?= -g
CFLAGS += -W -Wall -pedantic -ansi -std=c99 -DVERSION=\"$(VERSION)\"
# The Ncurses library with wide character support is available as "lncurses"
# under macOS.
ifeq ($(shell uname -s),Darwin)
LDFLAGS += -lncurses
else
LDFLAGS += -lncursesw
endif
PREFIX ?= /usr/local
EXECUTABLE = ttysolitaire
SRC_DIR = src
SRC = $(SRC_DIR)/ttysolitaire.c
SRC_OBJECTS = $(SRC_DIR)/common.o \
$(SRC_DIR)/frame.o \
$(SRC_DIR)/card.o \
$(SRC_DIR)/stack.o \
$(SRC_DIR)/deck.o \
$(SRC_DIR)/cursor.o \
$(SRC_DIR)/keyboard.o \
$(SRC_DIR)/gui.o \
$(SRC_DIR)/game.o \
TESTS_EXECUTABLE = ttysolitaire_test
TESTS_DIR = tests
TESTS_SRC = $(TESTS_DIR)/ttysolitaire_test.c
TESTS_OBJECTS = $(TESTS_DIR)/frame_test.o \
$(TESTS_DIR)/card_test.o \
$(TESTS_DIR)/stack_test.o \
$(TESTS_DIR)/deck_test.o \
$(TESTS_DIR)/cursor_test.o \
$(TESTS_DIR)/keyboard_test.o \
$(TESTS_DIR)/gui_test.o \
$(TESTS_DIR)/game_test.o \
$(TESTS_DIR)/test_helper.o \
$(TESTS_DIR)/test_helper_test.o \
.PHONY: test clean install uninstall
all: ${EXECUTABLE}
ttysolitaire: $(SRC_OBJECTS)
$(CC) $(CFLAGS) $(SRC) -o $(EXECUTABLE) $(SRC_OBJECTS) $(LDFLAGS)
test: $(SRC_OBJECTS) $(TESTS_OBJECTS)
$(CC) $(CFLAGS) $(TESTS_SRC) -o $(TESTS_EXECUTABLE) $(TESTS_OBJECTS) $(SRC_OBJECTS) $(LDFLAGS)
./$(TESTS_EXECUTABLE)
clean:
rm -rf $(SRC_DIR)/*.o $(TESTS_DIR)/*.o $(EXECUTABLE) $(TESTS_EXECUTABLE)
install:
install -d $(DESTDIR)$(PREFIX)/bin
install -m755 $(EXECUTABLE) $(DESTDIR)$(PREFIX)/bin/$(EXECUTABLE)
uninstall:
rm -f $(PREFIX)/bin/$(EXECUTABLE)