11825bd4 |
1 | # Useful options you might want to put on the make command line: |
2 | # |
3 | # - `SLANG=yes' to build against libslang instead of libncurses |
4 | # (libncurses is better and more reliable, but libslang might be |
5 | # all you have on a particular platform if you're unlucky). |
6 | # |
7 | # - `XFLAGS=-DNO_LARGE_FILES' to leave out the 64-bit file access |
8 | # support (restricts Tweak to editing files under 2Gb, but |
9 | # should cause it to compile successfully on platforms without |
10 | # fseeko and ftello and/or long long support). |
11 | # |
12 | # - `VERSION=X.XX' (for whatever X.XX you like) to cause the `make |
13 | # release' target to build a release tarball called |
14 | # `tweak-X.XX.tar.gz' which unpacks into a directory |
15 | # `tweak-X.XX'. Note that you also need to modify the version |
16 | # number in tweak.h, or else the resulting binary won't match |
17 | # the version number on the archive. |
18 | |
6e182d98 |
19 | CC := gcc |
20 | CFLAGS := -g -c -Wall $(XFLAGS) |
21 | LINK := gcc |
22 | LFLAGS := |
23 | LIBS := |
24 | |
2a700721 |
25 | PREFIX=/usr/local |
26 | BINDIR=$(PREFIX)/bin |
27 | MANDIR=$(PREFIX)/man/man1 |
28 | |
6e182d98 |
29 | TWEAK := main.o keytab.o actions.o search.o rcfile.o buffer.o btree.o |
30 | |
31 | ifeq ($(SLANG),yes) |
32 | # INCLUDE += -I/path/to/slang/include |
33 | # LIBS += -L/path/to/slang/lib |
34 | LIBS += -lslang |
35 | TWEAK += slang.o |
36 | else |
37 | LIBS += -lncurses |
38 | TWEAK += curses.o |
39 | endif |
40 | |
41 | .c.o: |
42 | $(CC) $(CFLAGS) $*.c |
43 | |
d28a4799 |
44 | all: tweak tweak.1 btree.html |
6e182d98 |
45 | |
46 | tweak: $(TWEAK) |
47 | $(LINK) -o tweak $(TWEAK) $(LIBS) |
48 | |
49 | tweak.1: manpage.but |
50 | halibut --man=$@ $< |
51 | |
d28a4799 |
52 | btree.html: btree.but |
53 | halibut --html=$@ $< |
54 | |
55 | # Ensure tweak.h reflects this version number, and then run a |
56 | # command like `make release VERSION=3.00'. |
57 | release: tweak.1 btree.html |
58 | mkdir -p reltmp/tweak-$(VERSION) |
7cf0466a |
59 | for i in LICENCE *.c *.h *.but tweak.1 btree.html Makefile; do \ |
d28a4799 |
60 | ln -s ../../$$i reltmp/tweak-$(VERSION); \ |
61 | done |
62 | (cd reltmp; tar chzvf ../tweak-$(VERSION).tar.gz tweak-$(VERSION)) |
63 | rm -rf reltmp |
64 | |
2a700721 |
65 | install: tweak tweak.1 |
66 | mkdir -p $(BINDIR) |
67 | install tweak $(BINDIR)/tweak |
68 | mkdir -p $(MANDIR) |
69 | install -m 0644 tweak.1 $(MANDIR)/tweak.1 |
70 | |
6e182d98 |
71 | clean: |
d28a4799 |
72 | rm -f *.o tweak tweak.1 btree.html |
6e182d98 |
73 | |
74 | main.o: main.c tweak.h |
75 | keytab.o: keytab.c tweak.h |
76 | actions.o: actions.c tweak.h |
77 | search.o: search.c tweak.h |
78 | rcfile.o: rcfile.c tweak.h |
79 | buffer.o: buffer.c tweak.h btree.h |
80 | slang.o: slang.c tweak.h |
81 | curses.o: curses.c tweak.h |
82 | btree.o: btree.c btree.h |