Debian Codegraph @

libpd/test_libpd/Makefile

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 # This is a makefile to build "test_libpd". It assumes that libpd is in the
2 # source directory "../" and that libpd is already built.
3
4 # detect platform
5 UNAME = $(shell uname)
6 SOLIB_PREFIX = lib
7
8 ifeq ($(UNAME), Darwin) # Mac
9 SOLIB_EXT = dylib
10 STATICLIB_EXT = a
11 PLATFORM = mac
12 else
13 ifeq ($(OS), Windows_NT) # Windows, use Mingw
14 SOLIB_PREFIX =
15 SOLIB_EXT = dll
16 STATICLIB_EXT = lib
17 PLATFORM = windows
18 else # assume Linux
19 SOLIB_EXT = so
20 STATICLIB_EXT = a
21 PLATFORM = linux
22 endif
23 endif
24
25 PD_DIR = ../..
26 LIBPD_DIR = ..
27 LIBPD = $(SOLIB_PREFIX)pd.$(SOLIB_EXT)
28 LIBPD_STATIC = $(LIBPD_DIR)/libpd.$(STATICLIB_EXT)
29
30 SRC_FILES = test_libpd.c
31 TARGET = test_libpd
32
33 CFLAGS = -I$(PD_DIR)/src -O3
34
35 .PHONY: libs clean-libs clean clobber
36
37 all: $(TARGET)
38
39 ##### libs
40
41 # build libpd and move a copy here
42 $(LIBPD):
43 make -C $(LIBPD_DIR)
44 cp $(LIBPD_DIR)/$(LIBPD) .
45
46 # on windows, copy libpd and MinGW winpthread dll to here
47 ifeq ($(PLATFORM), windows)
48
49 LDFLAGS = $(LIBPD)
50
51 PTHREAD_DIR = ${MINGW_PREFIX}/bin
52 PTHREAD = libwinpthread-1.dll
53
54 $(PTHREAD):
55 cp $(PTHREAD_DIR)/$(PTHREAD) .
56
57 libs: $(LIBPD) $(PTHREAD)
58
59 clean-libs:
60 rm -f $(LIBPD) $(PTHREAD)
61
62 # mac & linux
63 else
64
65 # force static linking? make STATIC=true
66 ifeq ($(STATIC), true)
67 LDFLAGS = $(LIBPD_STATIC)
68 else # copy libpd to here by default
69 LDFLAGS = $(LIBPD)
70 libs: $(LIBPD)
71 endif
72
73 clean-libs:
74 rm -f $(LIBPD)
75
76 endif
77
78 ##### target
79
80 $(TARGET): ${SRC_FILES:.c=.o} libs
81 $(CC) -o $@ ${SRC_FILES:.c=.o} $(LDFLAGS)
82
83 ##### clean
84
85 clean: clean-libs
86 rm -f $(TARGET) *.o