forked from sshipway/wanderer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
89 lines (68 loc) · 2.09 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Makefile for wanderer - modified by Bill Randle 6/30/88
# modified again by [email protected]
# and again by me.. [email protected]
# and yet again by [email protected]
# Make clean - Marina Brown [email protected] 2001,2
PROGRAM = wanderer
TOOLS = convert passwords
SRC_TOOLS = $(addsuffix .c,$(TOOLS))
SRCS = $(filter-out $(SRC_TOOLS),$(wildcard *.c))
OBJS = $(patsubst %.c,%.o,$(SRCS))
CC ?= cc
CFLAGS ?= -O -s
CFLAGS += -std=c99 -Wall -Wextra
CPPFLAGS += -D_POSIX_C_SOURCE=200809L
LDLIBS += -lncurses
INSTALL = install
INSTALL_BIN = $(INSTALL) -D -m 755
INSTALL_DATA = $(INSTALL) -D -m 644
INSTALL_MAN = $(INSTALL) -D -m 644
PREFIX = /usr/local
BIN_DIR = $(PREFIX)/bin
SHARE_DIR = $(PREFIX)/share
MAN_DIR = $(PREFIX)/share/man
MAN1_DIR = $(MAN_DIR)/man1
MAN6_DIR = $(MAN_DIR)/man6
WANDERERPATH = $(SHARE_DIR)/wanderer
SCREENPATH = $(SHARE_DIR)/wanderer/screens
HISCOREPATH = $(SHARE_DIR)/wanderer/hiscore
CPPFLAGS += -DPREFIX=$(PREFIX) \
-DSCREENPATH='"$(SCREENPATH)"' \
-DHISCOREPATH='"$(HISCOREPATH)"'
all: $(PROGRAM)
.PHONY: all
$(PROGRAM): $(OBJS)
convert: CPPFLAGS += -D__CONVERT
convert: convert.c encrypt.c encrypt.h
$(CC) $(CFLAGS) $(CPPFLAGS) $< encrypt.c -o $@
passwords: passwords.c
$(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@
%.o: %.c %.h wand_head.h
install:
$(INSTALL_DATA) -t $(SCREENPATH) screens/*
touch $(HISCOREPATH)
[ $(USER) = root ] && chown root:games $(HISCOREPATH) || true
[ $(USER) = root ] && chmod g+w $(HISCOREPATH) || true
$(INSTALL_BIN) $(PROGRAM) $(BIN_DIR)/$(PROGRAM)
[ $(USER) = root ] && chown root:games $(BIN_DIR)/$(PROGRAM) || true
[ $(USER) = root ] && chmod g+s $(BIN_DIR)/$(PROGRAM) || true
$(INSTALL_MAN) wanderer.6 $(MAN6_DIR)
.PHONY: install
clean:
$(RM) $(OBJS)
.PHONY: clean
distclean:
$(RM) $(OBJS)
$(RM) wanderer
$(RM) $(TOOLS)
.PHONY: distclean
uninstall:
$(RM) $(BIN_DIR)/$(PROGRAM)
$(RM) -r $(WANDERERPATH)
$(RM) $(MAN6_DIR)wanderer.6
.PHONY: uninstall
test: wanderer
touch hiscore
echo -e "#hljkSsavegame\n" > keypress
HISCOREPATH=hiscore ./wanderer < keypress
./passwords 1000