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