-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
44 lines (32 loc) · 911 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
44
.POSIX:
.SUFFIXES:
CC := cc
CFLAGS := -std=c99 -D_POSIX_C_SOURCE=199309L -Wall -Wextra -Wpedantic -O2
# Debug Mode
# CFLAGS += -Og -ggdb -fsanitize=address,undefined -DDEBUG -Werror
LDFLAGS := `pkg-config --libs ncursesw`
PREFIX := /usr/local
INSTALL_DIR := $(DESTDIR)$(PREFIX)/bin/
MAN_DIR := $(DESTDIR)$(PREFIX)/man/man6/
OBJECTS = main.o grid.o tetriminos.o
TEST_OBJECTS = grid_test.o grid.o tetriminos.o
all: dotris
.PHONY: test clean install install-man
dotris: $(OBJECTS)
$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) -c $<
test: LDFLAGS += `pkg-config --libs check`
test: $(TEST_OBJECTS)
$(CC) $(CFLAGS) -o $@ $? $(LDFLAGS)
./test
clean:
rm -f dotris dotris.6.gz test *.o
install-man:
gzip -fk dotris.6
mkdir -p $(MAN_DIR)
install dotris.6.gz $(MAN_DIR)
install: dotris install-man
mkdir -p $(INSTALL_DIR)
install dotris $(INSTALL_DIR)