2021-09-03 16:03:20 +00:00
|
|
|
VERSION = 1.3.1
|
2018-06-18 01:13:26 +00:00
|
|
|
|
2017-11-03 15:49:29 +00:00
|
|
|
CC ?= gcc
|
|
|
|
CFLAGS ?= -g
|
2021-11-03 12:56:31 +00:00
|
|
|
CFLAGS += -W -Wall -pedantic -ansi -std=c99 -DVERSION=\"$(VERSION)\"
|
2013-12-24 16:41:02 +00:00
|
|
|
|
2020-05-31 19:57:08 +00:00
|
|
|
# The Ncurses library with wide character support is available as "lncurses"
|
|
|
|
# under macOS.
|
2013-12-24 16:41:02 +00:00
|
|
|
ifeq ($(shell uname -s),Darwin)
|
2017-11-03 15:49:29 +00:00
|
|
|
LDFLAGS += -lncurses
|
|
|
|
else
|
|
|
|
LDFLAGS += -lncursesw
|
2013-12-24 16:41:02 +00:00
|
|
|
endif
|
|
|
|
|
2018-08-12 21:27:20 +00:00
|
|
|
PREFIX ?= /usr/local
|
2010-03-29 00:11:29 +00:00
|
|
|
|
2011-05-31 06:03:13 +00:00
|
|
|
EXECUTABLE = ttysolitaire
|
|
|
|
SRC_DIR = src
|
2014-08-21 05:46:46 +00:00
|
|
|
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 \
|
2011-02-06 23:28:11 +00:00
|
|
|
|
2011-05-31 06:03:13 +00:00
|
|
|
TESTS_EXECUTABLE = ttysolitaire_test
|
|
|
|
TESTS_DIR = tests
|
2014-08-21 05:46:46 +00:00
|
|
|
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 \
|
2011-02-06 23:28:11 +00:00
|
|
|
|
2014-08-21 05:51:52 +00:00
|
|
|
.PHONY: test clean install uninstall
|
2013-03-16 16:55:17 +00:00
|
|
|
|
2017-11-03 15:48:07 +00:00
|
|
|
all: ${EXECUTABLE}
|
|
|
|
|
2014-08-21 05:46:46 +00:00
|
|
|
ttysolitaire: $(SRC_OBJECTS)
|
|
|
|
$(CC) $(CFLAGS) $(SRC) -o $(EXECUTABLE) $(SRC_OBJECTS) $(LDFLAGS)
|
2011-02-06 23:28:11 +00:00
|
|
|
|
2014-08-21 05:46:46 +00:00
|
|
|
test: $(SRC_OBJECTS) $(TESTS_OBJECTS)
|
2020-05-31 19:57:08 +00:00
|
|
|
$(CC) $(CFLAGS) $(TESTS_SRC) -o $(TESTS_EXECUTABLE) $(TESTS_OBJECTS) $(SRC_OBJECTS) $(LDFLAGS)
|
|
|
|
./$(TESTS_EXECUTABLE)
|
2010-03-29 00:11:29 +00:00
|
|
|
|
|
|
|
clean:
|
2020-05-31 19:57:08 +00:00
|
|
|
rm -rf $(SRC_DIR)/*.o $(TESTS_DIR)/*.o $(EXECUTABLE) $(TESTS_EXECUTABLE)
|
2013-03-16 16:55:17 +00:00
|
|
|
|
|
|
|
install:
|
2020-05-31 19:57:08 +00:00
|
|
|
install -d $(DESTDIR)$(PREFIX)/bin
|
|
|
|
install -m755 $(EXECUTABLE) $(DESTDIR)$(PREFIX)/bin/$(EXECUTABLE)
|
2013-03-16 16:59:55 +00:00
|
|
|
|
|
|
|
uninstall:
|
2020-05-31 19:57:08 +00:00
|
|
|
rm -f $(PREFIX)/bin/$(EXECUTABLE)
|