File: Makefile

package info (click to toggle)
wildmidi 0.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,332 kB
  • sloc: ansic: 14,455; sh: 351; makefile: 284
file content (120 lines) | stat: -rw-r--r-- 2,859 bytes parent folder | download
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Makefile to build WildMidi library and player for Mac OS X.

# Set to 1 for debug build
DEBUG = 0

# The tools
ifeq ($(CROSS),)
CC=gcc
AS=as
AR=ar
RANLIB=ranlib
LIPO=lipo
else
CC=$(CROSS)-gcc
AS=$(CROSS)-as
AR=$(CROSS)-ar
RANLIB=$(CROSS)-ranlib
LIPO=$(CROSS)-lipo
endif
LD = $(CC)

DYLIB_MAJ=2
DYLIB_MID=1
DYLIB_MIN=0

LIBNAME=WildMidi
LIBSTATIC=lib$(LIBNAME).a
LIBSHARED=lib$(LIBNAME).dylib
LIBSHARED_FULL=lib$(LIBNAME).$(DYLIB_MAJ).$(DYLIB_MID).$(DYLIB_MIN).dylib
LIBSHARED_MAJ=lib$(LIBNAME).$(DYLIB_MAJ).dylib
LIB_INSTALLNAME=$(LIBSHARED_MAJ)
PLAYER=wildmidi
PLAYER_STATIC=wildmidi-static

INCLUDE=-I. -I../include
ARFLAGS=cr
CFLAGS=$(INCLUDE) -Wall -W -fno-common
LDFLAGS=
LDLIBS=
ifeq ($(DEBUG),1)
CFLAGS+=-g
else
CFLAGS+=-O2 -fomit-frame-pointer -ffast-math
endif
# specifically for 10.5 and newer:
#CFLAGS+=-mmacosx-version-min=10.5
#LDFLAGS+=-mmacosx-version-min=10.5
# specifically for 10.6 and newer:
#CFLAGS+=-mmacosx-version-min=10.6
#LDFLAGS+=-mmacosx-version-min=10.6 -Wl,-lbundle1.o

CFLAGS_LIB=$(CFLAGS) -DWILDMIDI_BUILD
LDFLAGS_LIB=$(LDFLAGS)
LDLIBS_LIB=$(LDLIBS)
LDFLAGS_LIB+=-dynamiclib -Wl,-single_module
LDFLAGS_LIB+=-Wl,-undefined,error
LDFLAGS_LIB+=-Wl,-install_name,"@executable_path/$(LIB_INSTALLNAME)"
LDFLAGS_LIB+=-Wl,-compatibility_version,$(DYLIB_MAJ).0.0 -Wl,-current_version,$(DYLIB_MAJ).$(DYLIB_MID).$(DYLIB_MIN)

CFLAGS_EXE=$(CFLAGS)
LDFLAGS_EXE=$(LDFLAGS)
LDLIBS_EXE=$(LDLIBS)
# OpenAL output support (comment out if not wanted)
CFLAGS_EXE+=-DAUDIODRV_OPENAL
LDFLAGS_EXE+=-Wl,-framework,OpenAL
LDLIBS_EXE+=-L. -l$(LIBNAME)

# Objects
LIB_OBJ = wm_error.o file_io.o lock.o wildmidi_lib.o reverb.o gus_pat.o
LIB_OBJ+= f_xmidi.o f_mus.o f_hmp.o f_midi.o f_hmi.o mus2mid.o xmi2mid.o internal_midi.o patches.o sample.o
PLAYER_OBJ = wm_tty.o wildmidi.o

.PHONY: clean distclean

help:
	@echo "Valid targets:"
	@echo ""
	@echo "  $(MAKE) shared"
	@echo "  $(MAKE) static"
	@echo ""

shared: $(LIBSHARED) $(PLAYER)
shared: CFLAGS_LIB+=-fvisibility=hidden -DSYM_VISIBILITY

static: $(LIBSTATIC) $(PLAYER_STATIC)
static: CFLAGS+=-DWILDMIDI_STATIC

$(LIBSHARED_FULL): $(LIB_OBJ)
	$(CC) $^ $(LDFLAGS_LIB) $(LDLIBS_LIB) -o $@
$(LIBSHARED_MAJ): $(LIBSHARED_FULL)
	ln -s $^ $@
$(LIBSHARED): $(LIBSHARED_MAJ)
	ln -s $^ $@

$(LIBSTATIC): $(LIB_OBJ)
	$(AR) $(ARFLAGS) $@ $^
	$(RANLIB) $@

$(PLAYER): $(PLAYER_OBJ) $(LIBSHARED)
	$(LD) $(PLAYER_OBJ) $(LDFLAGS_EXE) $(LDLIBS_EXE) -o $@

$(PLAYER_STATIC): $(PLAYER_OBJ) $(LIBSTATIC)
	$(LD) $(PLAYER_OBJ) $(LDFLAGS_EXE) $(LDLIBS_EXE) -o $@

# Build rules
%.o: %.c
	$(CC) -c $(CFLAGS_LIB) -o $@ $<
%.o: ../src/%.c
	$(CC) -c $(CFLAGS_LIB) -o $@ $<
# for player objects:
wildmidi.o: ../src/wildmidi.c
	$(CC) -c $(CFLAGS_EXE) -o $@ $<
wm_tty.o: ../src/wm_tty.c
	$(CC) -c $(CFLAGS_EXE) -o $@ $<

clean:
	rm -rf $(LIB_OBJ) $(PLAYER_OBJ)

distclean: clean
	rm -rf *.a *.dylib $(PLAYER) $(PLAYER_STATIC)