3 SRCDIR
= $(realpath
$(dir $(firstword $(MAKEFILE_LIST
))))
5 ALL
= *.c
*.h config.mk Makefile LICENSE README.md vis
.1
7 DEPS_ROOT
= $(SRCDIR
)/dependency
/install
8 DEPS_PREFIX
= $(DEPS_ROOT
)/usr
9 DEPS_BIN
= $(DEPS_PREFIX
)/bin
10 DEPS_LIB
= $(DEPS_PREFIX
)/lib
11 DEPS_INC
= $(DEPS_PREFIX
)/include
13 LIBTERMKEY
= libtermkey-0.18
14 LIBTERMKEY_SHA1
= 0a78ba7aaa2f3b53f2273268366fef349c9be4ab
19 cp config.def.h config.h
21 vis
: config.h config.mk
*.c
*.h
22 @echo
${CC} ${CFLAGS} ${CFLAGS_VIS} *.c
${LDFLAGS} ${LDFLAGS_VIS} -o
$@
23 @
${CC} ${CFLAGS} ${CFLAGS_VIS} *.c
${LDFLAGS} ${LDFLAGS_VIS} -o
$@
26 @
$(MAKE
) CFLAGS_VIS
='${DEBUG_CFLAGS_VIS}'
29 @
$(MAKE
) CFLAGS_VIS
='${DEBUG_CFLAGS_VIS} -pg'
33 @
rm -f vis vis-
${VERSION}.
tar.gz
36 @echo creating
dist tarball
37 @mkdir
-p vis-
${VERSION}
38 @cp
-R
${ALL} vis-
${VERSION}
39 @
rm -f vis-
${VERSION}/config.h
40 @
tar -cf vis-
${VERSION}.
tar vis-
${VERSION}
41 @gzip vis-
${VERSION}.
tar
42 @
rm -rf vis-
${VERSION}
45 @echo stripping executable
47 @echo installing executable file to
${DESTDIR}${PREFIX}/bin
48 @mkdir
-p
${DESTDIR}${PREFIX}/bin
49 @cp
-f vis
${DESTDIR}${PREFIX}/bin
50 @chmod
755 ${DESTDIR}${PREFIX}/bin
/vis
51 @cp
-f vis-open
${DESTDIR}${PREFIX}/bin
52 @chmod
755 ${DESTDIR}${PREFIX}/bin
/vis-open
53 @echo installing manual page to
${DESTDIR}${MANPREFIX}/man1
54 @mkdir
-p
${DESTDIR}${MANPREFIX}/man1
55 @sed
"s/VERSION/${VERSION}/g" < vis
.1 > ${DESTDIR}${MANPREFIX}/man1
/vis
.1
56 @chmod
644 ${DESTDIR}${MANPREFIX}/man1
/vis
.1
59 @echo removing executable file from
${DESTDIR}${PREFIX}/bin
60 @
rm -f
${DESTDIR}${PREFIX}/bin
/vis
61 @echo removing manual page from
${DESTDIR}${MANPREFIX}/man1
62 @
rm -f
${DESTDIR}${MANPREFIX}/man1
/vis
.1
65 @git archive
--prefix=vis-
$(RELEASE
)/ -o vis-
$(RELEASE
).
tar.gz
$(RELEASE
)
70 dependency
/sources
/libtermkey-
%: | dependency
/sources
71 wget
-c
-O
$@.part http
://www.leonerd.org.uk
/code
/libtermkey
/$(LIBTERMKEY
).
tar.gz
73 [ -z
$(LIBTERMKEY_SHA1
) ] ||
(echo
'$(LIBTERMKEY_SHA1) $@' | sha1sum
-c
)
75 dependency
/sources
/extract-libtermkey
: dependency
/sources
/$(LIBTERMKEY
).
tar.gz
76 tar xzf
$< -C
$(dir $<)
79 dependency
/sources
/build-libtermkey
: dependency
/sources
/extract-libtermkey
80 # TODO no sane way to avoid pkg-config and specify LDFLAGS?
81 sed
-i
's/LDFLAGS+=-lncurses$$/LDFLAGS+=-lncursesw/g' $(dir $<)/$(LIBTERMKEY
)/Makefile
82 make
-C
$(dir $<)/$(LIBTERMKEY
) PREFIX
=$(DEPS_PREFIX
) termkey.h libtermkey.la
85 dependency
/sources
/install-libtermkey
: dependency
/sources
/build-libtermkey
86 make
-C
$(dir $<)/$(LIBTERMKEY
) PREFIX
=$(DEPS_PREFIX
) install
89 dependencies
: dependency
/sources
/install-libtermkey
92 CFLAGS
="$(CFLAGS) -I$(DEPS_INC)" LDFLAGS
="$(LDFLAGS) -L$(DEPS_LIB)" make CFLAGS_TERMKEY
= LDFLAGS_TERMKEY
=-ltermkey
93 @echo Run with
: LD_LIBRARY_PATH
=$(DEPS_LIB
) .
/vis
95 .PHONY
: all clean dist install uninstall debug profile dependencies local