aboutsummaryrefslogtreecommitdiff
path: root/desiredata/src/makefile.in
blob: 9f88deefe3154f213a8296125ddbb8a4219fb31e (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
cvs_root_dir = ../..
pd_src = $(cvs_root_dir)/pd
INCLUDE = -I$(pd_src)/src
GFLAGS = -DINSTALL_PREFIX=\"$(prefix)\"

EXT= @EXT@
LIBSUFFIX = @LIBSUFFIX@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
mandir = @mandir@
# varibles to match packages/Makefile.buildlayout so that they can be easily
# overridden when building Pd-extended builds. <hans@at.or.at>
libpddir = $(libdir)/pd
pddocdir = $(libpddir)/doc
libpdbindir = $(libpddir)/bin

MORECFLAGS = @MORECFLAGS@
LDFLAGS = @LDFLAGS@
LDSOFLAGS = @LDSOFLAGS@
CPPFLAGS = -DDESIRE -DDONTUSESIMD -DPD @CPPFLAGS@
CFLAGS = $(CPPFLAGS) @CFLAGS@ $(MORECFLAGS)
CFLAGS += -Wall -Wextra -Wno-unused-parameter -I.
CFLAGS += -DINSTALL_PREFIX=\"$(prefix)\"

STRIP = @STRIP@

# --------------------- win32 ---------------------------
WATCHDOG = @WATCHDOG@
WLIB = @WLIB@
EXE = @EXE@
# variables to build on mingw <colet.patrice@free.fr>
#-----------------------------------------------------------

SRCXX = desire.c kernel.c builtins.c builtins_dsp.c s_path.c s_inter.c s_main.c \
	m_sched.c s_loader.c d_soundfile.c d_ugen.c s_audio.c s_midi.c \
	m_fifo.c m_simd.c d_mayer_fft.c d_fftroutine.c @AUDIOSRC@ @MIDISRC@
OBJ = $(SRCXX:.c=.o) $(SRC:.c=.o)
SO = libpd$(LIBSUFFIX)

#  ------------------ targets ------------------------------------

.PHONY: bin externs all

all:: bin externs

bin:: pd$(EXE) $(WATCHDOG) pdsend$(EXE) pdreceive$(EXE)

$(SRCXX:.c=.o): %.o: %.c config.log
	$(CXX) $(CFLAGS) -xc++ -c -o $*.o $*.c

$(SO): $(OBJ) config.log
	$(CXX) $(LDSOFLAGS) $(LDFLAGS) $(DBG_CFLAGS) -I../src -o $(SO) $(OBJ) $(WLIB)

pd$(EXE): $(OBJ) config.log $(SO) main.c
	$(CXX) $(LDFLAGS) $(DBG_CFLAGS) $$PWD/$(SO) main.c -o pd$(EXE)

pd-watchdog$(EXE): s_watchdog.c
	$(CXX) $(CFLAGS) $(STRIPFLAG) -o pd-watchdog$(EXE) s_watchdog.c

pd.com: main.o
	$(CXX) $(LDFLAGS) $(DBG_CFLAGS) $(CFLAGS) -o pd.com main.o $(LIBS) -L../src -lpd
	strip --strip-unneeded -R .note -R .comment pd.com

# i should sort out the LDFLAGS thing so that pd,pdsend,pdreceive don't get linked to all libs that libpd.so is linked to.
# note that MinGW really wants LDFLAGS at the end of the line, not the middle, according to patco.

pdsend$(EXE): u_pdsend.c config.log
	$(CXX) $(CFLAGS) $(STRIPFLAG) -o pdsend$(EXE) u_pdsend.c $(LDFLAGS)
	$(STRIP) pdsend$(EXE)

pdreceive$(EXE): u_pdreceive.c config.log
	$(CXX) $(CFLAGS) $(STRIPFLAG) -o pdreceive$(EXE) u_pdreceive.c $(LDFLAGS)
	$(STRIP) pdreceive$(EXE)

externs::
	cd ../extra; for ext in bonk~ choice expr~ fiddle~ loop~ lrshift~ pique sigmund~; do \
		cd $$ext; make @EXTERNTARGET@ || break; cd ..; done

install:: all
	install -d $(DESTDIR)$(bindir)
	install -d $(DESTDIR)$(libpdbindir)
	for file in defaults.ddrc pkgIndex.tcl poe.tcl bgerror.tcl; do \
		install $$file $(DESTDIR)$(libpdbindir)/$$file; done
	install $(BINARYMODE) $(SO) $(DESTDIR)$(libdir)/$(SO)
	test -w /etc/ld.so.cache && ldconfig || true
	$(CXX) $(LDFLAGS) $(DBG_CFLAGS) main.c -o $(DESTDIR)$(bindir)/pd$(EXE) $(WSTRIP)
	install -m755 desire.tk   $(DESTDIR)$(bindir)/desire.tk
	install -m755 desire   $(DESTDIR)$(bindir)/desire
	install -m755 pdsend$(EXE)      $(DESTDIR)$(bindir)/pdsend$(EXE)
	install -m755 pdreceive$(EXE)   $(DESTDIR)$(bindir)/pdreceive$(EXE)
	install -m755 $(WATCHDOG) $(DESTDIR)$(libpdbindir)/$(WATCHDOG)
	find locale   -name .svn -prune -o -type f -exec install -D -m644 '{}' $(DESTDIR)$(libpdbindir)/'{}' ';'
	find icons    -name .svn -prune -o -type f -exec install -D -m644 '{}' $(DESTDIR)$(libpddir)/'{}' ';'
	find ../doc   -name .svn -prune -o -type f -exec install -D -m644 '{}' $(DESTDIR)$(pddocdir)/'{}' ';'
	find ../extra -name .svn -prune -o -type f -exec install -D -m644 '{}' $(DESTDIR)$(libpddir)/'{}' ';'
	install -d $(DESTDIR)$(includedir)
	for file in m_pd.h desire.h; do install -m644 $$file $(DESTDIR)$(includedir)/$$file; done
	install -d $(DESTDIR)$(mandir)/man1
	for page in pd.1 pdsend.1 pdreceive.1; do \
		gzip < ../man/$$page > $(DESTDIR)$(mandir)/man1/$$page.gz; chmod 644 $(DESTDIR)$(mandir)/man1/$$page.gz; done

local-clean::
	-rm -f *.o pd$(EXE) pdsend$(EXE) pdreceive$(EXE) $(WATCHDOG) m_stamp.c
	-rm -f *~
	-(cd ../doc/6.externs; rm -f *.$(EXT))
	-rm -f makefile.deps
	touch makefile.deps
	#chmod 666 makefile.deps # what was this for??

extra-clean::
	-rm -f `find ../extra/ -name "*.pd_*"`
	-rm -f tags

clean:: extra-clean local-clean

distclean:: clean
	-rm -f config.cache config.log config.status makefile tags \
		autom4te.cache/output.* autom4te.cache/traces.* autom4te.cache/requests
	-rmdir autom4te.cache
	-rm -rf autom4te-*.cache

tags:: $(SRC) $(GSRC); ctags *.[ch]

depend:: makefile.deps

makefile.deps: makefile
	$(CXX) $(CPPFLAGS) -MM $(SRC) $(SRCXX) > makefile.deps

uninstall::
	rm -f -r $(DESTDIR)$(libpddir)
	rm -f $(DESTDIR)$(libdir)/libpd*
	cd $(DESTDIR)$(bindir);      rm pd$(EXE) pdsend$(EXE) pdreceive$(EXE)
	cd $(DESTDIR)$(includedir);  rm m_pd.h desire.h
	cd $(DESTDIR)$(mandir)/man1; rm pd.1.gz pdsend.1.gz pdreceive.1.gz

test:: all
	cd ../extra/pureunity && make test

include makefile.deps

# echo $$LD_LIBRARY_PATH | sed 's/:/\n/g' | grep -q '^$(DESTDIR)$(libdir)$$'