This repository has been archived by the owner on Jul 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
149 lines (121 loc) · 3.36 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
CC = gcc
GIT = git
#OPTS = -g -Wall -Wextra
PREFIX = /usr/local
MAN_PREFIX = $(PREFIX)
COMPVERSION = 6.33
LIBVERSION = 6.12.1
NAME = inform
BINNAME = $(NAME)
BINDIR = $(PREFIX)/bin
DISTNAME = $(BINNAME)-$(COMPVERSION)-$(LIBVERSION)
distdir = $(DISTNAME)
LIBDIR = $(PREFIX)/share/$(BINNAME)/lib
INCLUDEDIR = $(PREFIX)/share/$(BINNAME)/include
MANPAGE = $(NAME).1
MANDIR = $(MAN_PREFIX)/man/man1
DEFINES= -DUNIX -DInclude_Directory=\",$(INCLUDEDIR),$(LIBDIR)\" -DTemporary_Directory=\"/tmp\"
SRC = src
LIBSRC = lib
DEMO = demos
TUTOR = tutor
SOURCES = $(wildcard ${SRC}/*.c)
OBJECTS = $(patsubst %.c,%.o,${SOURCES})
LIBRARY = lib
LIB_LINKS = English.h Grammar.h Parser.h Verblib.h VerbLib.h
DEMO_SRC = $(wildcard ${DEMO}/*.inf)
DEMO_Z5 = $(patsubst %.inf,%.z5,${DEMO})
DEMODIR = $(PREFIX)/share/$(BINNAME)/demos
TUTOR_SRC = $(wildcard ${TUTOR}/*.inf)
TUTOR_Z5 = $(patsubst %.inf,%.z5,${TUTOR_SRC})
TUTORDIR = $(PREFIX)/share/$(BINNAME)/tutor
.PHONY: all clean lib
all: lib $(BINNAME) lib demos tutor
# Rules
%.o: %.c
$(CC) $(DEFINES) $(OPTS) -o $@ -c $<
$(BINNAME): $(OBJECTS)
$(CC) -o $@ $^
%.z5: %.inf $(BINNAME)
$(PWD)/$(BINNAME) +lib $< $@
lib:
@ cd $(LIBSRC); \
for file in $(LIB_LINKS); do \
realfile=`echo $$file | tr '[A-Z]' '[a-z]'`; \
echo $$realfile $$file; \
test -r $$file || ln -s $$realfile $$file; \
done
demos: lib $(BINNAME) $(DEMO_Z5)
tutor: lib $(BINNAME) $(TUTOR_Z5)
strip: $(BINNAME)
strip $(BINNAME)
submodule: submodules
submodules:
ifneq ($(and $(wildcard .git),$(shell which git)),)
rm -rf $(SRC) $(LIBSRC)
@$(GIT) submodule init
@$(GIT) submodule update
@$(GIT) submodule update
else
@echo "Not in a git repository or git command missing."
@echo "Just try \"make\" now."
endif
install: $(BINNAME) lib
install -d -m 755 $(BINDIR)
install -c -m 755 $(BINNAME) $(BINDIR)
install -d -m 755 $(LIBDIR)
install -c -m 644 $(wildcard ${LIBSRC}/*) $(LIBDIR)
install -d -m 755 $(INCLUDEDIR)
install -c -m 644 $(wildcard include/*) $(INCLUDEDIR)
install -d -m 755 $(MANDIR)
install -c -m 644 $(MANPAGE) $(MANDIR)
install -d -m 755 $(DEMODIR)
install -c -m 644 $(wildcard ${DEMO}/*) $(DEMODIR)
install -d -m 755 $(TUTORDIR)
install -c -m 644 $(wildcard ${TUTOR}/*) $(TUTORDIR)
install -c -m 755 contrib/pblorb.pl $(BINDIR)
install -c -m 755 contrib/scanblorb.pl $(BINDIR)
install-strip: strip install
uninstall:
rm -f $(PREFIX)/bin/$(BINNAME)
rm -f $(PREFIX)/bin/pblorb.pl
rm -f $(PREFIX)/bin/scanblorb.pl
rm -rf $(LIBDIR)
rm -rf $(INCLUDEDIR)
rm -rf $(DEMODIR)
rm -rf $(TUTORDIR)
dist: distclean
mkdir $(distdir)
@for file in `ls`; do \
if test $$file != $(distdir); then \
cp -Rp $$file $(distdir)/$$file; \
fi; \
done
find $(distdir) -type l -exec rm -f {} \;
rm -rf $(distdir)/${SRC}/.git* $(distdir)/${SRC}/.deps
rm -rf $(distdir)/${LIBSRC}/.git* $(distdir)/${LIBSRC}/.deps
tar chof $(distdir).tar $(distdir)
gzip -f --best $(distdir).tar
rm -rf $(distdir)
@echo
@echo "$(distdir).tar.gz created"
@echo
clean:
rm -f $(BINNAME)
rm -f ${SRC}/*.o
rm -f ${DEMO}/*z5
rm -f ${TUTOR}/*z5
cd $(LIBSRC); \
for file in $(LIB_LINKS); do \
rm -f $$file; \
done
gitclean:
ifneq ($(and $(wildcard .git),$(shell which git)),)
$(GIT) clean -fdx
else
@echo "Not in a git repository or git command missing."
endif
distclean: clean
find . -name *core -exec rm -f {} \;
-rm -rf $(distdir)
-rm -f $(distdir).tar $(distdir).tar.gz