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

DEBUG?=0
OS := $(shell uname -s)

ifeq ($(DEBUG),1)
	CFLAGS += -O0 -g -ggdb -DDEBUG
endif
ifeq ($(OS),Linux)
  PDSUF = .pd_linux
  PDBUNDLEFLAGS = -shared -rdynamic
  LDSOFLAGS = -lm
endif
ifeq ($(OS),Darwin)
  PDSUF = .pd_darwin
  INCLUDES = -I/Library/Frameworks/Tcl.framework/Headers
  PDBUNDLEFLAGS = -bundle -flat_namespace -undefined dynamic_lookup
  LDSOFLAGS = -lm
endif
ifeq (MINGW,$(findstring MINGW,$(UNAME)))
  PDSUF = .dll
  PDBUNDLEFLAGS = -shared
  LDSOFLAGS = -lm
endif

INCLUDES =  -I../../pd/src -I/usr/include
CFLAGS += -Wall -fPIC
CFLAGS += -DPDSUF=\"$(PDSUF)\"
ifeq ($(DEBUG),0)
	CFLAGS += -O2
endif

all: atoi.pd_linux atof.pd_linux

clean:
	rm -f *.pd_linux *.o *~ atoi.c atof.c

atoi.c: atox.c
	sed -e s/ATOX/$*/g $< > $@

atof.c: atox.c
	sed -e s/ATOX/$*/g $< > $@

.SUFFIXES: .c .o $(PDSUF)

.o$(PDSUF):
	$(CC) $(PDBUNDLEFLAGS) $(CFLAGS) $(INCLUDES) -o $*$(PDSUF) $< $(LDSOFLAGS)