]> git.cworth.org Git - scherzo/blob - Makefile
Add support for drawing a key signature
[scherzo] / Makefile
1 all: scherzo
2
3 scherzo_srcs :=         \
4         mnemon/mnemon.c \
5         pitch.c         \
6         scherzo.c       \
7         score.c
8
9 scherzo_modules = $(scherzo_srcs:.c=.o)
10
11 CFLAGS ?= -g
12 WARN_CFLAGS = -Wall -Wextra -Wmissing-declarations
13
14 SCHERZO_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags) -I./mnemon `pkg-config --cflags gtk+-2.0 alsa`
15
16 SCHERZO_LDFLAGS = $(LDFLAGS) `pkg-config --libs gtk+-2.0 alsa` -ltalloc -lm
17
18 # The user has not set any verbosity, default to quiet mode and inform the
19 # user how to enable verbose compiles.
20 ifeq ($(V),)
21 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
22 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
23 endif
24 # The user has explicitly enabled quiet compilation.
25 ifeq ($(V),0)
26 quiet = @printf "$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
27 endif
28 # Otherwise, print the full command line.
29 quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
30
31 .deps/%.d: %.c Makefile
32         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
33         $(CC) -M $(CPPFLAGS) $(SCHERZO_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
34         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
35         rm -f $@.$$$$
36
37 DEPS := $(scherzo_srcs:%.c=.deps/%.d)
38 -include $(DEPS)
39
40 %.o: %.c Makefile
41         $(call quiet,CC $(CFLAGS)) -c $(SCHERZO_CFLAGS) $< -o $@
42
43 scherzo: $(scherzo_modules)
44         $(call quiet,CC $(CFLAGS)) $^ $(SCHERZO_LDFLAGS) -o $@
45
46 CLEAN := $(CLEAN) scherzo $(scherzo_modules)
47
48 .PHONY : clean
49 clean:
50         rm -f $(CLEAN); rm -rf .deps
51