-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
123 lines (91 loc) · 2.64 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
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
121
122
# chugin name
CHUGIN_NAME=MAUI
# all of the c/cpp files that compose this chugin
C_MODULES=
CXX_MODULES=MAUI.cpp util_icon.cpp miniAudicle_import.cpp \
miniAudicle_ui_elements.cpp chuck_ui.cpp
OBJCXX_MODULES=chuck_ui_mac.mm miniAudicle_ui_elements_mac.mm
# where the chuck source code is
CK_SRC_PATH?=chuck/include/
# ---------------------------------------------------------------------------- #
# you won't generally need to change anything below this line for a new chugin #
# ---------------------------------------------------------------------------- #
# default target: print usage message and quit
current:
@echo "[chuck build]: please use one of the following configurations:"
@echo " make linux, make mac, make mac-ub, or make win32"
ifneq ($(CK_TARGET),)
.DEFAULT_GOAL:=$(CK_TARGET)
ifeq ($(MAKECMDGOALS),)
MAKECMDGOALS:=$(.DEFAULT_GOAL)
endif
endif
.PHONY: mac mac-ub linux linux-oss linux-jack linux-alsa win32
mac mac-ub linux linux-oss linux-jack linux-alsa win32: all
CC=gcc
CXX=g++
OBJCXX=g++
LD=g++
CHUGIN_PATH=/usr/lib/chuck
ifneq (,$(strip $(filter mac bin-dist-mac,$(MAKECMDGOALS))))
include makefile.mac
endif
ifneq (,$(strip $(filter mac-ub bin-dist-mac,$(MAKECMDGOALS))))
include makefile.mac-ub
endif
ifneq (,$(strip $(filter linux,$(MAKECMDGOALS))))
include makefile.linux
endif
ifneq (,$(strip $(filter linux-oss,$(MAKECMDGOALS))))
include makefile.linux
endif
ifneq (,$(strip $(filter linux-jack,$(MAKECMDGOALS))))
include makefile.linux
endif
ifneq (,$(strip $(filter linux-alsa,$(MAKECMDGOALS))))
include makefile.linux
endif
ifneq (,$(strip $(filter win32,$(MAKECMDGOALS))))
include makefile.win32
endif
FLAGS+=-I$(CK_SRC_PATH)
ifneq ($(CHUCK_DEBUG),)
FLAGS+= -g
else
FLAGS+= -O3
endif
ifneq ($(CHUCK_STRICT),)
FLAGS+= -Wall
endif
# default: build a dynamic chugin
CK_CHUGIN_STATIC?=0
ifeq ($(CK_CHUGIN_STATIC),0)
SUFFIX=.chug
else
SUFFIX=.schug
FLAGS+= -D__CK_DLL_STATIC__
endif
C_OBJECTS=$(addsuffix .o,$(basename $(C_MODULES)))
CXX_OBJECTS=$(addsuffix .o,$(basename $(CXX_MODULES)))
OBJCXX_OBJECTS=$(addsuffix .o,$(basename $(OBJCXX_MODULES)))
CHUG=$(addsuffix $(SUFFIX),$(CHUGIN_NAME))
all: $(CHUG)
$(CHUG): $(C_OBJECTS) $(CXX_OBJECTS) $(OBJCXX_OBJECTS)
ifeq ($(CK_CHUGIN_STATIC),0)
$(LD) $(LDFLAGS) -o $@ $^
else
ar rv $@ $^
ranlib $@
endif
$(C_OBJECTS): %.o: %.c
$(CC) $(FLAGS) -c -o $@ $<
$(CXX_OBJECTS): %.o: %.cpp $(CK_SRC_PATH)/chuck_dl.h
$(CXX) $(FLAGS) -c -o $@ $<
$(OBJCXX_OBJECTS): %.o: %.mm $(CK_SRC_PATH)/chuck_dl.h
$(OBJCXX) $(FLAGS) -c -o $@ $<
install: $(CHUG)
mkdir -p $(CHUGIN_PATH)
cp $^ $(CHUGIN_PATH)
chmod 755 $(CHUGIN_PATH)/$(CHUG)
clean:
rm -rf $(C_OBJECTS) $(CXX_OBJECTS) $(OBJCXX_OBJECTS) $(CHUG)