-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
70 lines (51 loc) · 1.61 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# vim: ft=make noexpandtab
BINDIR := bin
OBJDIR := obj
OBJECTS := \
$(OBJDIR)/src/mindifil.o \
$(OBJDIR)/src/mindievt.o \
$(OBJDIR)/lib/mbeep/src/mbeep.o
OBJECTS_TESTS := \
$(OBJDIR)/tests/check.o \
$(OBJDIR)/tests/chkmdfil.o \
$(OBJDIR)/tests/chksetup.o \
$(OBJDIR)/tests/chkmdevt.o
MD := mkdir -v -p
CFLAGS := -Wall -Werror -fpic -DPLATFORM_XLIB -Ilib/mbeep/src -Ilib/maug/src
test_mindi: LDFLAGS += $(shell pkg-config --libs check) -L$(BINDIR)/static -lmindi
test_mindi: CFLAGS += -DCHECK -g
midibeep.exe: CFLAGS := -mm -os -hw -d0 -0 -DPLATFORM_DOS -i=./src
midibeep.exe: CC := wcc
midibeep.exe: LD := wcl
midibeep.exe: LDFLAGS :=
all: $(BINDIR)/static/libmindi.a $(BINDIR)/shared/libmindi.so test_mindi mididump midibeep
mididump: $(OBJDIR)/src/mididump.o | $(BINDIR)/static/libmindi.a
$(CC) -o $@ $^ -L$(BINDIR)/static -lmindi $(LDFLAGS)
midibeep: $(OBJDIR)/src/midibeep.o | $(BINDIR)/static/libmindi.a
$(CC) -o $@ $^ -L$(BINDIR)/static -lmindi $(LDFLAGS) -lasound
midibeep.exe: objdos/src/midibeep.o $(subst $(OBJDIR),objdos,$(OBJECTS))
$(LD) $(LDFLAGS) -fe=$@ $^
test_mindi: $(OBJECTS_TESTS) | $(BINDIR)/static/libmindi.a
$(MD) $(dir $@)
$(CC) -o $@ $^ $(LDFLAGS)
$(BINDIR)/static/libmindi.a: $(OBJECTS)
$(MD) $(dir $@)
$(AR) rcs $@ $^
$(BINDIR)/shared/libmindi.so: $(OBJECTS)
$(MD) $(dir $@)
$(CC) -shared -o $@ $^
objdos/%.o: %.c
$(MD) $(dir $@)
$(CC) $(CFLAGS) -fo=$@ $(<:%.c=%)
$(OBJDIR)/%.o: %.c
$(MD) $(dir $@)
$(CC) -c -o $@ $(CFLAGS) $<
.PHONY: clean
clean:
rm -rf $(OBJDIR); \
rm -rf objdos; \
rm -f test_mindi; \
rm -rf $(BINDIR); \
rm -f mididump; \
rm -f midibeep; \
rm -f midibeep.exe