blob: b82d6d802db30de4053e4f3be5e21b85b1b5b5ce (
plain)
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
56
57
58
59
60
61
62
63
|
.PHONY: all clean run sanitize backends windows full backends-full
OBJS = config.o backend.o plugin.o
PLUGINDIR = "\"./backends/\""
PLUGINDIR_W32 = "\"backends\\\\\""
SYSTEM := $(shell uname -s)
CFLAGS ?= -g -Wall -Wpedantic
# Hide all non-API symbols for export
CFLAGS += -fvisibility=hidden
#CFLAGS += -DDEBUG
midimonster: LDLIBS = -ldl
midimonster: CFLAGS += -DPLUGINS=$(PLUGINDIR)
# Work around strange linker passing convention differences in Linux and OSX
ifeq ($(SYSTEM),Linux)
midimonster: LDFLAGS += -Wl,-export-dynamic
endif
ifeq ($(SYSTEM),Darwin)
midimonster: LDFLAGS += -Wl,-export_dynamic
endif
all: midimonster backends
full: midimonster backends-full
windows: midimonster.exe
backends:
$(MAKE) -C backends
backends-full:
$(MAKE) -C backends full
# This rule can not be the default rule because OSX the target prereqs are not exactly the build prereqs
midimonster: midimonster.c portability.h $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $< $(OBJS) $(LDLIBS) -o $@
midimonster.exe: export CC = x86_64-w64-mingw32-gcc
#midimonster.exe: CFLAGS += -Wno-format
midimonster.exe: CFLAGS += -DPLUGINS=$(PLUGINDIR_W32) -Wno-format
midimonster.exe: LDLIBS = -lws2_32
midimonster.exe: LDFLAGS += -Wl,--out-implib,libmmapi.a
midimonster.exe: midimonster.c portability.h $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $< $(OBJS) $(LDLIBS) -o $@
# The windows build for backends requires the import library generated with the build,
# so the backends can't be a prerequisite for the executable...
$(MAKE) -C backends windows
clean:
$(RM) midimonster
$(RM) midimonster.exe
$(RM) libmmapi.a
$(RM) $(OBJS)
$(MAKE) -C backends clean
run:
valgrind --leak-check=full --show-leak-kinds=all ./midimonster
sanitize: export CC = clang
sanitize: export CFLAGS = -g -Wall -Wpedantic -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer
sanitize: midimonster backends
|