aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 57ecd8d83739a4a2fd6488ecf2d51b4d369d2a90 (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
#!/usr/bin/make

TCL_VERSION := $(shell (ls -1d /usr/include/tcl8.? | sed -n 's|.*/tcl\(8\.[0-9][0-9]*\).*|\1|p') || echo "")
TCL_INCLUDES := -I$(shell find /usr/include -name tcl.h | grep -v private | sed 's|/tcl.h$$||')
INCLUDES =  -I../../pd/src -I/usr/include $(TCL_INCLUDES)
CFLAGS += $(INCLUDES) -xc++ -funroll-loops -fno-operator-names -fno-omit-frame-pointer -falign-functions=16 -O2 -Wall -fPIC
LDSOFLAGS += -lm -ltcl$(TCL_VERSION)
CXX = g++
OS = linux
LDSHARED = $(CXX) $(PDBUNDLEFLAGS)

all:: tcl

clean::
	rm -f tcl.pd_linux tcl_wrap.cxx *.o *~

.SUFFIXES:

ifeq ($(OS),darwin)
  PDSUF = .pd_darwin
  PDBUNDLEFLAGS = -bundle -flat_namespace -undefined dynamic_lookup
else
  ifeq ($(OS),nt)
    PDSUF = .dll
    PDBUNDLEFLAGS = -shared
  else
    PDSUF = .pd_linux
    PDBUNDLEFLAGS = -shared -rdynamic
  endif
endif

tcl:: tcl.pd_linux

tcl.pd_linux: tcl_wrap.cxx tcl_extras.cxx tcl_loader.cxx tcl_extras.h Makefile
	$(LDSHARED) $(CFLAGS) -DPDSUF=\"$(PDSUF)\" -o tcl$(PDSUF) \
		tcl_wrap.cxx tcl_extras.cxx tcl_loader.cxx $(LDSOFLAGS)

tcl_wrap.cxx: tcl.i tcl_extras.h
	swig -v -c++ -tcl -o tcl_wrap.cxx $(INCLUDES) tcl.i