Avoid use of "?:"
[wiggle/upstream.git] / Makefile
blobfc2c194ddeb9526cf1abb69ea91e7306561acfb6
2 # Note on my Mobile Pentium II, -march=pentium2 delivers twice the performance of i386
3 #OptDbg=-O3
4 #OptDbg=-O3 -march=pentium2
5 OptDbg=-ggdb
6 ifndef CWFLAGS
7 CWFLAGS=-Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
8 endif
9 CFLAGS=$(OptDbg) -I. $(CWFLAGS)
11 PREFIX = /usr
12 # STRIP = -s
13 INSTALL = /usr/bin/install
14 DESTDIR =
15 BINDIR = $(PREFIX)/bin
16 MANDIR = $(PREFIX)/share/man
17 MAN1DIR = $(MANDIR)/man1
18 MAN5DIR = $(MANDIR)/man5
19 LDLIBS = -lncurses
21 all: wiggle wiggle.man test
23 wiggle : wiggle.o load.o parse.o split.o extract.o diff.o bestmatch.o ReadMe.o \
24 merge2.o vpatch.o ccan/hash/hash.o
25 wiggle.o load.o parse.o split.o extract.o diff.o bestmatch.o \
26 merge2.o vpatch.o :: wiggle.h
27 split.o :: ccan/hash/hash.h config.h
29 VERSION = $(shell [ -d .git ] && git 2> /dev/null describe HEAD)
30 VERS_DATE = $(shell [ -d .git ] && git 2> /dev/null log -n1 --format=format:%cd --date=short)
31 DVERS = $(if $(VERSION),-DVERSION=\"$(VERSION)\",)
32 DDATE = $(if $(VERS_DATE),-DVERS_DATE=\"$(VERS_DATE)\",)
33 CFLAGS += $(DVERS) $(DDATE)
35 test: wiggle dotest
36 ./dotest
38 valgrind: wiggle dotest
39 ./dotest valgrind
41 vtest: wiggle dovtest
42 ./dovtest
44 wiggle.man : wiggle.1
45 nroff -man wiggle.1 > wiggle.man
47 clean:
48 rm -f *.o ccan/hash/*.o *.man wiggle .version* demo.patch version
49 find . -name core -o -name '*.tmp*' -o -name .tmp -o -name .time | xargs rm -f
51 install : wiggle wiggle.1
52 $(INSTALL) -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(MAN1DIR)
53 $(INSTALL) $(STRIP) -m 755 wiggle $(DESTDIR)$(BINDIR)
54 $(INSTALL) -m 644 wiggle.1 $(DESTDIR)$(MAN1DIR)
56 version : ReadMe.c wiggle.1
57 @rm -f version
58 @sed -n -e 's/.*VERSION "\([0-9.]*\)".*/\1/p' ReadMe.c > .version-readme
59 @sed -n -e 's/.*WIGGLE 1 "" v\([0-9.]*\)$$/\1/p' wiggle.1 > .version-man
60 @cmp -s .version-readme .version-man && cat .version-man > version || { echo Inconsistant versions.; exit 1;}
62 dist : test clean version
63 mkdir -p DIST
64 rm -f DIST/wiggle-`cat version`
65 git archive --prefix wiggle-`cat version`/ v`cat version` | gzip -9 > DIST/wiggle-`cat version`.tar.gz
67 v : version
68 cat version
70 demo.patch: force
71 diff -rup demo.orig demo.patched | sed 's/demo.patched/demo/' > demo.patch
73 force: