Add `make install' target.
[sgt/tweak] / Makefile
CommitLineData
6e182d98 1CC := gcc
2CFLAGS := -g -c -Wall $(XFLAGS)
3LINK := gcc
4LFLAGS :=
5LIBS :=
6
2a700721 7PREFIX=/usr/local
8BINDIR=$(PREFIX)/bin
9MANDIR=$(PREFIX)/man/man1
10
6e182d98 11TWEAK := main.o keytab.o actions.o search.o rcfile.o buffer.o btree.o
12
13ifeq ($(SLANG),yes)
14# INCLUDE += -I/path/to/slang/include
15# LIBS += -L/path/to/slang/lib
16LIBS += -lslang
17TWEAK += slang.o
18else
19LIBS += -lncurses
20TWEAK += curses.o
21endif
22
23.c.o:
24 $(CC) $(CFLAGS) $*.c
25
d28a4799 26all: tweak tweak.1 btree.html
6e182d98 27
28tweak: $(TWEAK)
29 $(LINK) -o tweak $(TWEAK) $(LIBS)
30
31tweak.1: manpage.but
32 halibut --man=$@ $<
33
d28a4799 34btree.html: btree.but
35 halibut --html=$@ $<
36
37# Ensure tweak.h reflects this version number, and then run a
38# command like `make release VERSION=3.00'.
39release: tweak.1 btree.html
40 mkdir -p reltmp/tweak-$(VERSION)
7cf0466a 41 for i in LICENCE *.c *.h *.but tweak.1 btree.html Makefile; do \
d28a4799 42 ln -s ../../$$i reltmp/tweak-$(VERSION); \
43 done
44 (cd reltmp; tar chzvf ../tweak-$(VERSION).tar.gz tweak-$(VERSION))
45 rm -rf reltmp
46
2a700721 47install: tweak tweak.1
48 mkdir -p $(BINDIR)
49 install tweak $(BINDIR)/tweak
50 mkdir -p $(MANDIR)
51 install -m 0644 tweak.1 $(MANDIR)/tweak.1
52
6e182d98 53clean:
d28a4799 54 rm -f *.o tweak tweak.1 btree.html
6e182d98 55
56main.o: main.c tweak.h
57keytab.o: keytab.c tweak.h
58actions.o: actions.c tweak.h
59search.o: search.c tweak.h
60rcfile.o: rcfile.c tweak.h
61buffer.o: buffer.c tweak.h btree.h
62slang.o: slang.c tweak.h
63curses.o: curses.c tweak.h
64btree.o: btree.c btree.h