2018-08-07 22:38:41 +02:00
|
|
|
|
|
|
|
#CFLAGS=-g -W -Wall
|
|
|
|
CFLAGS=-O3 -W -Wall
|
|
|
|
|
|
|
|
prefix=/usr/local
|
|
|
|
bindir=$(DESTDIR)$(prefix)/bin
|
2018-08-16 18:34:02 +02:00
|
|
|
mandir=$(DESTDIR)$(prefix)/share/man/man1
|
2018-08-07 22:38:41 +02:00
|
|
|
datadir=$(DESTDIR)/etc
|
|
|
|
|
|
|
|
# Check to see whether we have Jack installed. Needs pkg-config.
|
|
|
|
JACK := $(shell pkg-config --libs jack 2>/dev/null)
|
|
|
|
|
|
|
|
OBJ = readconfig.o midizap.o jackdriver.o
|
|
|
|
|
2018-08-19 16:52:42 +02:00
|
|
|
# Only try to install the manual page if it's actually there, to prevent
|
|
|
|
# errors if pandoc isn't installed.
|
|
|
|
INSTALL_TARGETS = midizap $(wildcard midizap.1)
|
|
|
|
|
|
|
|
.PHONY: all world install uninstall man pdf clean realclean
|
|
|
|
|
2018-08-16 19:23:45 +02:00
|
|
|
all: midizap
|
|
|
|
|
2018-08-19 16:52:42 +02:00
|
|
|
# This also creates the manual page (see below).
|
|
|
|
world: all man
|
2018-08-07 22:38:41 +02:00
|
|
|
|
2018-08-22 01:02:05 +02:00
|
|
|
install: all
|
2018-08-16 18:34:02 +02:00
|
|
|
install -d $(bindir) $(datadir) $(mandir)
|
|
|
|
install midizap $(bindir)
|
2018-08-07 22:38:41 +02:00
|
|
|
install -m 0644 example.midizaprc $(datadir)/midizaprc
|
2018-08-19 16:52:42 +02:00
|
|
|
# If present, the manual page will be installed along with the program.
|
|
|
|
ifneq ($(findstring midizap.1, $(INSTALL_TARGETS)),)
|
2018-08-16 18:34:02 +02:00
|
|
|
install -m 0644 midizap.1 $(mandir)
|
2018-08-19 16:52:42 +02:00
|
|
|
else
|
|
|
|
@echo "Manual page not found, create it with 'make man'."
|
|
|
|
endif
|
2018-08-07 22:38:41 +02:00
|
|
|
|
|
|
|
uninstall:
|
2018-08-16 18:34:02 +02:00
|
|
|
rm -f $(bindir)/midizap $(mandir)/midizap.1 $(datadir)/midizaprc
|
2018-08-07 22:38:41 +02:00
|
|
|
|
|
|
|
midizap: $(OBJ)
|
|
|
|
gcc $(CFLAGS) $(OBJ) -o midizap -L /usr/X11R6/lib -lX11 -lXtst $(JACK)
|
|
|
|
|
2018-08-19 16:52:42 +02:00
|
|
|
# This creates the manual page from the README. Requires pandoc
|
|
|
|
# (http://pandoc.org/).
|
|
|
|
man: midizap.1
|
|
|
|
|
|
|
|
# Manual page in pdf format. This also needs groff.
|
|
|
|
pdf: midizap.pdf
|
|
|
|
|
2018-08-16 18:34:02 +02:00
|
|
|
midizap.1: README.md
|
|
|
|
pandoc -s -tman $< > $@
|
|
|
|
|
2018-08-19 16:52:42 +02:00
|
|
|
midizap.pdf: midizap.1
|
|
|
|
# This assumes that man does the right thing when given a file instead of a
|
|
|
|
# program name, and that it understands groff's -T option.
|
|
|
|
man -Tpdf ./midizap.1 > $@
|
|
|
|
|
2018-08-07 22:38:41 +02:00
|
|
|
clean:
|
|
|
|
rm -f midizap keys.h $(OBJ)
|
|
|
|
|
2018-08-16 18:34:02 +02:00
|
|
|
realclean:
|
2018-08-19 16:52:42 +02:00
|
|
|
rm -f midizap midizap.1 midizap.pdf keys.h $(OBJ)
|
2018-08-16 18:34:02 +02:00
|
|
|
|
2018-08-07 22:38:41 +02:00
|
|
|
keys.h: keys.sed /usr/include/X11/keysymdef.h
|
|
|
|
sed -f keys.sed < /usr/include/X11/keysymdef.h > keys.h
|
|
|
|
|
|
|
|
readconfig.o: midizap.h keys.h
|
|
|
|
midizap.o: midizap.h jackdriver.h
|
|
|
|
jackdriver.o: jackdriver.h
|