aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/makefile.pd-linux
blob: 21863ab38c8b29817003ae5063082582472d28d7 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# flext - C++ layer for Max/MSP and pd (pure data) externals
# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
#
# Makefile for gcc @ linux
#
# usage:
# to build run "make -f makefile.pd-linux"
# to install (as root), do "make -f makefile.pd-linux install"
#

CONFIG=config-pd-linux.txt

include $(CONFIG)

# compiler+linker stuff 
INCLUDES=$(PDPATH) $(SNDOBJ)
FLAGS=-DFLEXT_SYS=2 
CFLAGS=-O6 -mcpu=pentiumpro
CFLAGS_D=-mcpu=pentiumpro -g
CFLAGS_T=-DFLEXT_THREADS
LIBS=

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

NAME=flext

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

ifdef SNDOBJ
_SRCS=$(SRCS) $(SRCS_SNDOBJ)
_HDRS=$(HDRS) $(HDRS_SNDOBJ)
else
_SRCS=$(SRCS)
_HDRS=$(HDRS)
endif

MAKEFILE=makefile.pd-linux
TARGET=$(TARGDIR)/$(NAME).a 
TARGET_D=$(TARGDIR)/$(NAME)_d.a
TARGET_T=$(TARGDIR)/$(NAME)_t.a
TARGET_TD=$(TARGDIR)/$(NAME)_td.a

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

$(TARGDIR):
	mkdir $(TARGDIR)

$(patsubst %,source/%,$(_SRCS)): $(patsubst %,source/%,$(_HDRS)) $(patsubst %,source/%,$(IHDRS)) $(MAKEFILE) $(CONFIG)
	touch $@

$(TARGDIR)/%.o : source/%.cpp
	$(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) source) $< -o $@

$(TARGDIR)/%.do : source/%.cpp
	$(CXX) -c $(CFLAGS_D) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) source) $< -o $@

$(TARGDIR)/%.to : source/%.cpp
	$(CXX) -c $(CFLAGS) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) source) $< -o $@

$(TARGDIR)/%.tdo : source/%.cpp
	$(CXX) -c $(CFLAGS_D) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) source) $< -o $@

$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(_SRCS)) 
	ar rc $@ $^ 
	chmod 755 $@

$(TARGET_D) : $(patsubst %.cpp,$(TARGDIR)/%.do,$(_SRCS)) 
	ar rc $@ $^ 
	chmod 755 $@

$(TARGET_T) : $(patsubst %.cpp,$(TARGDIR)/%.to,$(_SRCS))
	ar rc $@ $^
	chmod 755 $@

$(TARGET_TD) : $(patsubst %.cpp,$(TARGDIR)/%.tdo,$(_SRCS))
	ar rc $@ $^
	chmod 755 $@

.PHONY: clean install

clean:
	rm -f $(TARGDIR)/*.{o,do,to,tdo} $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD)
	
ifdef INSTDIR
$(INSTDIR):
	-mkdir $(INSTDIR)

install:: $(INSTDIR)
endif

install:: $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD)  $(patsubst %,source/%,$(_HDRS))
	cp $^ $(INSTDIR)
	chmod 755 $(patsubst %,$(INSTDIR)/%,$(notdir $^))
	chown root.users $(patsubst %,$(INSTDIR)/%,$(notdir $^))