aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/dyn/makefile.pd-darwin
blob: dec7743b044bacd7b51402db1440588e5b41ce44 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
# Makefile for gcc @ darwin
# 
# usage:
# to build run "make -f makefile.pd-darwin"
# to install (as root), do "make -f makefile.pd-darwin install"
#

CONFIG=config-pd-darwin.txt

include ${CONFIG}

# compiler+linker stuff 
INCLUDES=${PDPATH}
FLAGS=${UFLAGS}

# compiler flags for optimized build
CFLAGS=-O2

# compiler flags for debug build
CFLAGS_D=-g

# flags for shared linking
LSHFLAGS= -dylib -dynamic -flat_namespace -undefined suppress

# frameworks
#FRAMEWORKS=Carbon veclib


# ----------------------------------------------
# the rest can stay untouched
# ----------------------------------------------

# all the source files from the package
include make-files.txt

MAKEFILE=makefile.pd-darwin

TARGET=$(TARGDIR)/lib$(NAME).dylib
TARGET_D=$(TARGDIR)/lib$(NAME)_d.dylib
HDRS=$(PHDRS) $(IHDRS)


all: $(TARGDIR) $(TARGET) $(TARGET_D)

$(TARGDIR):
	mkdir $(TARGDIR)

$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(patsubst %,$(SRCDIR)/%,$(IHDRS)) $(MAKEFILE) $(CONFIG)
	touch $@

$(TARGDIR)/%.o : $(SRCDIR)/%.cpp
	$(CXX) -c -dynamic $(CFLAGS) $(CFLAGS_T)  $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $(patsubst %,-F%,$(FRAMEWORKS)) $< -o $@

$(TARGDIR)/%.do : $(SRCDIR)/%.cpp 
	$(CXX) -c -dynamic $(CFLAGS_D) $(CFLAGS_T)  $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $(patsubst %,-F%,$(FRAMEWORKS)) $< -o $@

$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS))
	ld $(LSHFLAGS) -o $@ $^ -ldylib1.o -lgcc -lstdc++ $(patsubst %,-framework %,$(FRAMEWORKS)) 

$(TARGET_D) : $(patsubst %.cpp,$(TARGDIR)/%.do,$(SRCS))
	ld $(LSHFLAGS) -o $@ $^ -ldylib1.o -lgcc -lstdc++ $(patsubst %,-framework %,$(FRAMEWORKS)) 

.PHONY: clean install

clean:
	rm -f $(TARGDIR)/*.{o,do} $(TARGET) $(TARGET_D)
	
ifdef PREFIX

install:: $(PREFIX)
endif

install:: $(TARGET) $(TARGET_D)
#	cp $(patsubst %,$(SRCDIR)/%,$(PHDRS)) $(PREFIX)/include
	cp $(TARGDIR)/lib*.dylib $(PREFIX)/lib