-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
55 lines (39 loc) · 1.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
include local.mk # User configurable section
EXTPKG := jack sndfile # extern package dependencies
CFLAGS += -Os -g -Wall -Wextra -pipe $(shell pkg-config --cflags $(EXTPKG))
LDFLAGS += $(shell pkg-config --libs $(EXTPKG))
TMP_WILD := $(TMP_WILD) *~ *.bak cscope.*
TMP_PAT := $(subst *,%,$(TMP_WILD))
RELEASE := $(shell tr -d '"' < csrc/release.h)
MYNAME := jack-file
DISTNAME := $(MYNAME)-$(RELEASE)
PROGS := file2jack jacktransportloop
MANS := $(addprefix man/, $(PROGS:=.1))
DESKTOPS := $(wildcard data/*.desktop)
CLEAN_FILES := $(MANS) $(PROGS)
.PHONY: clean all srcdist
all: $(PROGS) $(MANS)
%: csrc/%.c $(wildcard csrc/*.h) Makefile
$(CC) $(CFLAGS) -std=c99 -D_REENTRANT $< -lm -lpthread -lrt $(LDFLAGS) -o $@
man/%.1: % $(filter-out $(wildcard man), man) Makefile
help2man -N -o $@ $(abspath $<) || { $< --help || :; $< --version || :; false; }
install: all installdirs
$(INSTALL_PROGRAM) $(PROGS) $(DESTDIR)$(bindir)
$(INSTALL_DATA) $(MANS) $(DESTDIR)$(man1dir)
# $(INSTALL_DATA) $(DESKTOPS) $(DESTDIR)$(datadir)/applications
clean:
set -f; for pat in $(TMP_WILD); do find . -iname $$pat -exec rm {} \; ; done; \
rm -rf $(CLEAN_FILES)
srcdist: clean
git archive --format=tar --prefix=$(DISTNAME)/ HEAD | \
gzip -c >/tmp/$(DISTNAME).tar.gz
showvars:
@echo "RELEASE := " $(RELEASE)
@echo "TMP_PAT := " $(TMP_PAT)
@echo "CFLAGS := " $(CFLAGS)
@echo "LDFLAGS := " $(LDFLAGS)
man:
mkdir man
installdirs: mkinstalldirs
./mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \
$(DESTDIR)$(mandir) $(DESTDIR)$(man1dir) $(DESTDIR)$(datadir)/applications