-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
65 lines (58 loc) · 1.73 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
# Makefile
SHELL := /bin/bash
CC = gcc
CFLAGS = -O2 -ansi
V = 0
PREFIX = /usr
MANDIR = $(PREFIX)/share/man/man6
LIB = $(PREFIX)/share/retroinform
MAIN = inform6
# collect all source .c files
SRC = $(wildcard src/*.c)
# change suffixes from .c to .o
OBJ = $(SRC:.c=.o)
.c.o:
ifeq ($V, 0)
@echo " CC " $*.o
@$(CC) $(CFLAGS) -c $*.c -o $*.o
else
$(CC) $(CFLAGS) -c $*.c -o $*.o
endif
$(MAIN): $(OBJ)
ifeq ($V, 0)
@echo " CCLD " $@
@$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
else
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
endif
@strip $(MAIN)
.PHONY: clean
clean:
rm -f $(OBJ) $(MAIN)
.PHONY: install
install:
install -d $(DESTDIR)$(PREFIX)/bin
install -d $(DESTDIR)$(MANDIR)
install -d $(DESTDIR)$(LIB)
install -d $(DESTDIR)$(LIB)/{bin,demos,metro84,tutor}
install -c -m 755 $(MAIN) $(DESTDIR)$(PREFIX)/bin
install -c -m 755 bin/i6 $(DESTDIR)$(PREFIX)/bin
install -c -m 644 bin/a8.bin $(DESTDIR)$(LIB)/bin
install -c -m 644 demos/cloak.inf $(DESTDIR)$(LIB)/demos
install -c -m 644 demos/scenery.inf $(DESTDIR)$(LIB)/demos
install -c -m 644 demos/shell.inf $(DESTDIR)$(LIB)/demos
install -c -m 644 metro84/* $(DESTDIR)$(LIB)/metro84
install -c -m 644 tutor/* $(DESTDIR)$(LIB)/tutor
install -c -m 644 i6.6 $(DESTDIR)$(MANDIR)
gzip $(DESTDIR)$(MANDIR)/i6.6
ln -s $(LIB)/metro84/grammar.h $(DESTDIR)$(LIB)/metro84/Grammar.h
ln -s $(LIB)/metro84/parser.h $(DESTDIR)$(LIB)/metro84/Parser.h
ln -s $(LIB)/metro84/verblib.h $(DESTDIR)$(LIB)/metro84/VerbLib.h
ln -s $(LIB)/metro84/scenery.h $(DESTDIR)$(LIB)/metro84/Scenery.h
ln -s $(LIB)/metro84/flags.h $(DESTDIR)$(LIB)/metro84/Flags.h
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(MAIN)
rm -f $(DESTDIR)$(PREFIX)/bin/i6
rm -f $(DESTDIR)$(MANDIR)/i6.6.gz
rm -rf $(DESTDIR)$(LIB)