Newer
Older
# On Mac OS X, this needs to be defined to enable dlopen and weak linking
# support. Its safe on other platforms since gcc only checks this env var on
# Apple's gcc. <hans@at.or.at>
ifeq ($(shell uname -s),Darwin)
export MACOSX_DEPLOYMENT_TARGET = 10.3
endif
VPATH = ../obj:./
OBJ_DIR = ../obj
BIN_DIR = ../bin
EXT= @EXT@
GUINAME= @GUINAME@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
mandir = @mandir@
datarootdir = @datarootdir@
GFLAGS = -DINSTALL_PREFIX=\"$(prefix)\"
# 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-l2ork
pddocdir = $(libpddir)/doc
libpdbindir = $(libpddir)/bin
CPPFLAGS = @CPPFLAGS@
MORECFLAGS = @MORECFLAGS@
# if on 10.6/Intel, then build GUI as 32-bit
ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 10)
GINCLUDE = -arch i386 $(CPPFLAGS) -framework Tcl -framework Tk
else
GINCLUDE = $(CPPFLAGS) @GUIFLAGS@
endif
GLIB = @LIBS@
LDFLAGS = @LDFLAGS@
LIB = @PDLIB@
WARN_CFLAGS = -Wall -W -Wstrict-prototypes \
Mathieu L Bouchard
committed
-Wno-unused-parameter -Wno-parentheses -Wno-switch
#WARN_CFLAGS += -Werror=implicit-function-declaration
ARCH_CFLAGS = -DPD
CFLAGS = @CFLAGS@ $(ARCH_CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(MORECFLAGS)
Mathieu L Bouchard
committed
QTGUI = @qt@
# the sources
SYSSRC += @SYSSRC@
ASIOSRC = @ASIOSRC@
ASIOOBJ = $(ASIOSRC:.cpp=.o)
# these files cause a warning when using auto-vectorization:
# "warning: dereferencing type-punned pointer will break strict-aliasing rules"
TYPE_PUNNING_SRC = d_ctl.c d_array.c d_delay.c d_filter.c d_math.c d_osc.c d_soundfile.c
# these are safe for full gcc 4.x optimization
OPT_SAFE_SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
Mathieu L Bouchard
committed
g_undo.c g_all_guis.c g_bang.c g_mycanvas.c g_numbox.c \
g_toggle.c g_vumeter.c g_magicglass.c g_radio.c g_slider.c \
m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \
m_conf.c m_glob.c m_sched.c \
s_main.c s_inter.c s_file.c s_print.c \
s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \
s_utf8.c \
d_ugen.c d_arithmetic.c d_dac.c d_misc.c \
d_fft.c d_global.c \
d_resample.c \
x_arithmetic.c x_connective.c x_interface.c x_midi.c x_misc.c \
x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c x_list.c x_preset.c\
SRC = $(TYPE_PUNNING_SRC) $(OPT_SAFE_SRC)
TYPE_PUNNING_OBJ = $(TYPE_PUNNING_SRC:.c=.o)
OPT_SAFE_OBJ = $(OPT_SAFE_SRC:.c=.o)
ifeq ($(QTGUI), yes)
OBJ += g_qt.moc.o g_qt.o
endif
GOBJ = $(GSRC:.c=.o)
# get version from m_pd.h to use in doc/1.manual/1.introduction.txt
PD_MAJOR_VERSION := $(shell grep PD_MAJOR_VERSION m_pd.h | \
sed 's|^.define *PD_MAJOR_VERSION *\([0-9]*\).*|\1|' )
PD_MINOR_VERSION := $(shell grep PD_MINOR_VERSION m_pd.h | \
sed 's|^.define *PD_MINOR_VERSION *\([0-9]*\).*|\1|' )
PD_BUGFIX_VERSION := $(shell grep PD_BUGFIX_VERSION m_pd.h | \
sed 's|^.define *PD_BUGFIX_VERSION *\([0-9]*\).*|\1|' )
PD_TEST_VERSION := $(shell grep PD_TEST_VERSION m_pd.h | \
sed 's|^.define *PD_TEST_VERSION *"\(.*\)".*|\1|' )
PD_VERSION := $(PD_MAJOR_VERSION).$(PD_MINOR_VERSION).$(PD_BUGFIX_VERSION)
ifneq ($(PD_TEST_VERSION),)
PD_VERSION := $(PD_VERSION)-$(PD_TEST_VERSION)
endif
# C++/Qt
CXX = g++
CXXFLAGS =
MOC = moc
QT_INCLUDE = -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore
ifeq ($(QTGUI),yes)
LDFLAGS += -L/usr/lib/i386-linux-gnu
LIB += -lQt5Core -lQt5Gui -lQt5Widgets
endif
#
# ------------------ targets ------------------------------------
#
.PHONY: pd gui externs all bin pd tkpath tkdnd install \
TAGS etags etags_Darwin etags_Linux etags_MINGW
all: pd $(BIN_DIR)/pd-watchdog gui $(BIN_DIR)/pdsend \
$(BIN_DIR)/pdreceive externs
bin: pd $(BIN_DIR)/pd-watchdog gui $(BIN_DIR)/pdsend \
$(BIN_DIR)/pdreceive
$(OPT_SAFE_OBJ) : %.o : %.c
$(CC) $(CFLAGS) $(OPT_CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
$(CC) $(CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
$(GOBJ) : %.o : %.c
$(CC) $(CFLAGS) $(GFLAGS) $(GINCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
$(ASIOOBJ): %.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.cpp
../obj/g_qt.moc.cpp : g_qt.h
$(MOC) $(subst $(CPPFLAGS),-fno-strict-aliasing,) $(QT_INCLUDE) $< -o ../obj/$@
../obj/g_qt.moc.o : ../obj/g_qt.moc.cpp
$(CXX) $(CFLAGS) $(CXXFLAGS) $(QT_INCLUDE) -fPIC -c ../obj/g_qt.moc.cpp -o ../obj/g_qt.moc.o
../obj/g_qt.o : g_qt.cpp
$(CXX) $(CFLAGS) $(CXXFLAGS) $(QT_INCLUDE) -fPIC -c g_qt.cpp -o ../obj/g_qt.o
# just make sure ../bin exists without making it a target, because if you
# make it a target, "make" looks at the folder's changing timestamp and
# rebuilds for no reason. — Mathieu
NOTHING = $(shell mkdir -p $(BIN_DIR))
$(BIN_DIR)/pd-watchdog: s_watchdog.c
$(CC) $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pd-watchdog s_watchdog.c
$(BIN_DIR)/pdsend: u_pdsend.c
$(CC) $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdsend u_pdsend.c
$(BIN_DIR)/pdreceive: u_pdreceive.c $(BIN_DIR)
$(CC) $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c
ifeq ($(QTGUI),yes)
$(PDEXEC): $(OBJ)
cd ../obj; $(CXX) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) $(LIB)
else
$(PDEXEC): $(OBJ)
cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) $(LIB)
$(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) $(GLIB)
# if on 10.6/Intel, then force build GUI as 32-bit
ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 10)
ARCH_FLAG = -arch i386
else
ARCH_FLAG =
endif
#this is for Mac OSX only...
cd ../obj && $(CC) $(ARCH_FLAG) $(CFLAGS) -dynamiclib -read_only_relocs warning \
-o $(BIN_DIR)/libPdTcl.dylib $(GOBJ) \
-F@TCLTK_FRAMEWORKS_PATH@ \
-framework Tcl -framework Tk -framework System \
-Wl,-install_name,@executable_path/../Resources/bin/libPdTcl.dylib
install_name_tool -change @TCLTK_FRAMEWORKS_PATH@/Tcl.framework/Versions/8.4/Tcl\
@executable_path/../Frameworks/Tcl.framework/Versions/8.4/Tcl \
-change @TCLTK_FRAMEWORKS_PATH@/Tk.framework/Versions/8.4/Tk \
@executable_path/../Frameworks/Tk.framework/Versions/8.4/Tk \
../bin/libPdTcl.dylib
# this is for Windows/MinGW (only?)
$(BIN_DIR)/pdtcl.dll: $(GOBJ)
cd $(BIN_DIR); dllwrap --export-all-symbols --output-def pdtcl.def \
--output-lib=pdtcl.a --dllname=$(GUINAME) $(OBJ_DIR)/t_tkcmd.o $(LIB) $(GLIB)
strip --strip-unneeded $(BIN_DIR)/pdtcl.dll
externs:
make -C ../extra/bonk~ @EXTERNTARGET@
make -C ../extra/choice @EXTERNTARGET@
make -C ../extra/expr~ @EXTERNTARGET@
make -C ../extra/fiddle~ @EXTERNTARGET@
make -C ../extra/loop~ @EXTERNTARGET@
make -C ../extra/lrshift~ @EXTERNTARGET@
make -C ../extra/pique @EXTERNTARGET@
make -C ../extra/sigmund~ @EXTERNTARGET@
make -C ../extra/pd~ @EXTERNTARGET@
make -C ../extra/stdout @EXTERNTARGET@
../tkpath/Makefile: ../tkpath/Makefile.in ../tkpath/configure.in
cd ../tkpath && aclocal && autoconf && ./configure --prefix=$(prefix)
tkpath: ../tkpath/Makefile
../tkdnd/Makefile: ../tkdnd/Makefile.in ../tkdnd/configure.in
cd ../tkdnd && aclocal && autoconf && ./configure --prefix=$(prefix)
tkdnd: ../tkdnd/Makefile
make -C ../tkdnd
cd ../src
ABOUT_FILE=$(DESTDIR)$(pddocdir)/1.manual/1.introduction.txt
Mathieu L Bouchard
committed
install: all tkpath tkdnd
install -d $(DESTDIR)$(libpdbindir)
install $(BIN_DIR)/$(GUINAME) $(DESTDIR)$(libpdbindir)/$(GUINAME)
install $(BIN_DIR)/pd-watchdog $(DESTDIR)$(libpdbindir)/pd-watchdog
install -m644 pd.tk $(DESTDIR)$(libpdbindir)/pd.tk
install -m644 *.tcl $(DESTDIR)$(libpdbindir)/
install -m644 ../tkpath/library/tkpath.tcl $(DESTDIR)$(libpdbindir)/tkpath.tcl
install -m644 ../tkpath/libtkpath*so $(DESTDIR)$(libpdbindir)/
install -m644 ../tkdnd/library/tkdnd.tcl $(DESTDIR)$(libpdbindir)/tkdnd.tcl
install -m644 ../tkdnd/library/tkdnd_unix.tcl $(DESTDIR)$(libpdbindir)/tkdnd_unix.tcl
install -m644 ../tkdnd/library/tkdnd_compat.tcl $(DESTDIR)$(libpdbindir)/tkdnd_compat.tcl
install -m644 ../tkdnd/libtkdnd*so $(DESTDIR)$(libpdbindir)/
install -d $(DESTDIR)$(libpdbindir)/nw
install -d $(DESTDIR)$(libpdbindir)/css
install -d $(DESTDIR)$(libpdbindir)/locales
install -m644 ../nw/*.* $(DESTDIR)$(libpdbindir)/
install -m755 ../nw/nw/* $(DESTDIR)$(libpdbindir)/nw/
install -m644 ../nw/css/*.* $(DESTDIR)$(libpdbindir)/css/
for dir in $(shell ls -1 ../nw/locales); do \
echo "installing locale $$dir"; \
install -d $(DESTDIR)$(libpdbindir)/locales/$$dir ; \
install -m644 -p ../nw/locales/$$dir/*.* $(DESTDIR)$(libpdbindir)/locales/$$dir ; \
done
install $(BINARYMODE) $(PDEXEC) $(DESTDIR)$(bindir)/@PDEXEC@
# kludge to allow pd~ to work by default in pd-l2ork
rm -f $(DESTDIR)$(libpddir)/pd
ln -sf $(bindir)/pd-l2ork $(DESTDIR)$(libpddir)/pd-l2ork
ln -sf $(bindir)/pd-l2ork $(DESTDIR)$(libpdbindir)/pd-l2ork
install -m755 $(BIN_DIR)/pdsend $(DESTDIR)$(bindir)/pdsend
install -m755 $(BIN_DIR)/pdreceive $(DESTDIR)$(bindir)/pdreceive
for dir in $(shell ls -1 ../doc | grep -v CVS); do \
echo "installing $$dir"; \
install -d $(DESTDIR)$(pddocdir)/$$dir ; \
install -m644 -p ../doc/$$dir/*.* $(DESTDIR)$(pddocdir)/$$dir ; \
# kludge install of additional pd-l2ork data structures docs
cp -rf ../doc/4.data.structures/pd-l2ork $(DESTDIR)$(pddocdir)/4.data.structures/
# and now the rest
for dir in $(shell ls -1 ../doc/7.stuff | grep -v CVS); do \
echo "installing 7.stuff/$$dir"; \
install -d $(DESTDIR)$(pddocdir)/7.stuff/$$dir ; \
install -m644 -p ../doc/7.stuff/$$dir/*.* \
$(DESTDIR)$(pddocdir)/7.stuff/$$dir ; \
cat $(ABOUT_FILE).tmp | sed 's|PD_VERSION|Pd-l2ork version $(PD_TEST_VERSION)|' \
rsync -ax --exclude=.git --exclude=.svn ../extra $(DESTDIR)$(libpddir)/
install -d $(DESTDIR)$(includedir)/pd-l2ork
install -m644 m_pd.h $(DESTDIR)$(includedir)/pd-l2ork/m_pd.h
install -m644 m_imp.h $(DESTDIR)$(includedir)/pd-l2ork/m_imp.h
install -m644 g_canvas.h $(DESTDIR)$(includedir)/pd-l2ork/g_canvas.h
install -m644 s_stuff.h $(DESTDIR)$(includedir)/pd-l2ork/s_stuff.h
install -m644 g_all_guis.h $(DESTDIR)$(includedir)/pd-l2ork/g_all_guis.h
gzip < ../man/pd.1 > $(DESTDIR)$(mandir)/man1/@PDEXEC@.1.gz
chmod 644 $(DESTDIR)$(mandir)/man1/@PDEXEC@.1.gz
gzip < ../man/pdsend.1 > $(DESTDIR)$(mandir)/man1/pdsend.1.gz
chmod 644 $(DESTDIR)$(mandir)/man1/pdsend.1.gz
gzip < ../man/pdreceive.1 > $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
chmod 644 $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
@echo "Pd install succeeded."
-rm -f -- ../obj/*.moc.cpp
-rm -f -- $(OBJ)
-rm -f ../obj/* $(PDEXEC) $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
$(BIN_DIR)/pdreceive $(BIN_DIR)/pd-watchdog m_stamp.c
-(cd ../doc/6.externs; rm -f *.pd_linux)
-rm -f makefile.dependencies
touch makefile.dependencies
chmod 666 makefile.dependencies
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.dependencies
makefile.dependencies: makefile
$(CC) $(CPPFLAGS) -M $(SRC) > makefile.dependencies
uninstall:
rm -f $(DESTDIR)$(bindir)/pdsend
rm -f $(DESTDIR)$(bindir)/pdreceive
rm -f -r $(DESTDIR)$(includedir)/pd-l2ork/
rm -f $(DESTDIR)$(mandir)/man1/pd.1.gz
rm -f $(DESTDIR)$(mandir)/man1/pdsend.1.gz
rm -f $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
include makefile.dependencies
TAGS: etags
etags:
etags *.h $(SRC) $(SYSSRC)
etags --append --language=none --regex="/proc[ \t]+\([^ \t]+\)/\1/" pd.tk *.tcl
find /usr/include -type f -name \*.h -exec etags -a '{}' \;
make etags_`uname -s`
etags_Darwin:
find /System/Library/Frameworks -type f -name \*.h -exec etags -a '{}' \;
find /Library/Frameworks -type f -name \*.h -exec etags -a '{}' \;
find /sw/include -type f -name \*.h -exec etags -a '{}' \;
etags_Linux:
etags_MINGW:
find /usr/local/include/ -type f -name \*.h -exec etags -a '{}' \;