aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 193d9b6c50922ec05e9834d39ae8aff8959f3aa7 (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
99
100
101
# xmlrpc - XMLRPC external for PD
# 
# Makefile for gcc @ linux
#
# usage:
# to build run "make -f Makefile.linux"
# to install (as root), do "make -f Makefile.linux install"
#
#* Author: Thomas Grill t.grill [at] gmx.net
#
# License LGPL see LICENSE.txt
# IEM - Institute of Electronic Music and Acoustics, Graz
# Inffeldgasse 10/3, 8010 Graz, Austria
# http://iem.at 
#************************************************************/


# Configuration: ##########################


# where are the PD header files?
# leave it blank if it is a system directory (like /usr/local/include), 
# since gcc 3.2 complains about it
PDPATH=

# where should flext libraries be built?
TARGDIR=./pd-linux

# where are the XMLRPC++ header files?
XMLRPCPATH=xmlrpc++
XMLRPCINC=$(XMLRPCPATH)/src/
XMLRPCLIB=libXmlRpc.a

# where should the external be installed?
prefix = /usr/local
libdir = $(prefix)/lib
pkglibdir = $(libdir)/pd-externals
objectsdir = $(pkglibdir)

INSTALL = install
INSTALL_PROGRAM = $(INSTALL) -p -m 644
INSTALL_DATA = $(INSTALL) -p -m 644
INSTALL_DIR     = $(INSTALL) -p -m 755 -d

# additional compiler flags
# (check if they fit for your system!)
# UFLAGS=-mcpu=pentiumpro  # gcc 2.95
UFLAGS=-mcpu=pentium3 -msse  # gcc 3.2

###########################################

# compiler+linker stuff	
INCLUDES=$(PDPATH) $(XMLRPCINC)
LIBPATH= $(XMLRPCPATH)

FLAGS=-DPD -fPIC
CFLAGS=-O6 -Wno-write-strings
#CFLAGS=-g
LIBS=m util XmlRpc

# ---------------------------------------------
# the rest can stay untouched
# ----------------------------------------------
NAME=iemxmlrpc

# all the source files from the package
DIR=.
SRCS=main.cpp

MAKEFILE=Makefile

TARGET=$(TARGDIR)/$(NAME).pd_linux

# default target
all: $(XMLRPCPATH)/$(XMLRPCLIB) $(TARGDIR) $(TARGET) 

$(XMLRPCPATH)/$(XMLRPCLIB): $(XMLRPCPATH)
	make -C $(XMLRPCPATH)

$(patsubst %,$(DIR)/%,$(SRCS)): $(patsubst %,$(DIR)/%,$(HDRS)) $(MAKEFILE)
	touch $@

$(TARGDIR):
	mkdir -p $(TARGDIR)

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

$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS))
	$(CXX) -shared -fPIC $^ $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS)) -o $@ 
	chmod 755 $@

install: $(TARGET)
	$(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(NAME)
	$(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(objectsdir)/$(NAME)

.PHONY: clean
clean:
	make -C $(XMLRPCPATH) clean
	rm -f $(TARGDIR)/*.o $(TARGET)
	-rm -f *~