Makefile 8.36 KB
Newer Older
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
#
# This is a grand unifying Makefile for compiling Pd-extended under MinGW
#
all: install

export CC = gcc
CWD := $(shell pwd)

DESTDIR = $(CWD)/build
cvs_root_dir := $(shell cd $(CWD)/../.. && pwd)
BUILDLAYOUT_DIR = $(cvs_root_dir)/packages


include $(BUILDLAYOUT_DIR)/Makefile.buildlayout


# Generic x86 (tune for Pentium III, since that's most common these days)
OPT_CFLAGS += -mcpu=i586 -mtune=pentium3


# these are sent to all of the various Makefiles so that they all copy their
# output to the same directory tree
DEST_PATHS = BUILDLAYOUT_DIR=$(BUILDLAYOUT_DIR) \
				cvs_root_dir=$(cvs_root_dir) \
				DESTDIR=$(DESTDIR) \
				prefix=$(prefix) \
				OPT_CFLAGS="$(OPT_CFLAGS)" \
				UNAME=$(UNAME)

Albert Gräf's avatar
Albert Gräf committed
30 31 32
ifeq ($(LIGHT),yes)
PD_INNO_SETUP = pd-inno-light.iss
else
33
PD_INNO_SETUP = pd-inno.iss
Albert Gräf's avatar
Albert Gräf committed
34
endif
35 36 37 38

package:  $(PD_INNO_SETUP)
## this pops up the GUI app
#	start $(PD_INNO_SETUP)
39 40 41 42 43
## this compiles the package on the command line. On 64-bit Windows
#  we have to look in a different path, hence the ugly ifeq below...
ifeq (,$(wildcard /c/Program\ Files/Inno\ Setup\ 5/ISCC.exe))
	/c/Program\ Files\ \(x86\)/Inno\ Setup\ 5/ISCC.exe $(PD_INNO_SETUP)
else
44
	/c/Program\ Files/Inno\ Setup\ 5/ISCC.exe $(PD_INNO_SETUP)
45
endif
46 47 48
	@echo " "
	@echo "win32_inno install succeeded!"

49
git_version: $(pd_src)/src/s_stuff.h.in
50 51 52
	@cd $(pd_src)/src/ && \
	sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' s_stuff.h.in > s_stuff.h.new && \
	(test -f s_stuff.h && diff -q s_stuff.h s_stuff.h.new > /dev/null && rm -f s_stuff.h.new && echo s_stuff.h unchanged || (rm -f s_stuff.h && mv s_stuff.h.new s_stuff.h))
53 54

build_pd: git_version
55 56 57 58 59 60 61 62 63 64 65 66 67 68
	cd $(pd_src)/src && $(MAKE) -f makefile.mingw

pd_install: build_pd
# the autoconf/MinGW setup doesn't compile the extras yet
#	$(MAKE) -C $(pd_src)/src $(DEST_PATHS) bin
#	-$(MAKE) -C $(pd_src)/src $(DEST_PATHS) install
	$(MAKE) -C $(pd_src)/src -f makefile.mingw $(DEST_PATHS) install

install: pd_install prebuilt_install lib_install exe_install
	@echo " "
	@echo "win32_inno install succeeded!"


prebuilt_install:
Albert Gräf's avatar
Albert Gräf committed
69
	$(MAKE) -C $(packages_src) $(DEST_PATHS) extended_install INCREMENTAL=$(INCREMENTAL) LIGHT=$(LIGHT)
70
	$(MAKE) -C $(packages_src) $(DEST_PATHS) doc_format
Albert Gräf's avatar
Albert Gräf committed
71 72 73
ifeq ($(LIGHT),yes)
	install -p pd-settings-light.reg $(DESTDIR)$(prefix)/pd-settings.reg
else
74
	install -p pd-settings.reg $(DESTDIR)$(prefix)
Albert Gräf's avatar
Albert Gräf committed
75
endif
76 77 78 79 80 81 82

#==============================================================================#
#
## setup Pd binaries
#
#==============================================================================#

83
#bin_src = /usr/local/bin
Jonathan Wilkes's avatar
Jonathan Wilkes committed
84
bin_src = /mingw32/bin
85 86 87 88 89
system32 = /c/WINDOWS/system32
lib_install:
# ultimately, the DLLs should be installed in %SystemRoot%\system32 by
# InnoSetup since they are 'officially' named and versioned DLLs, and can be
# shared between apps
90 91 92 93 94
# GUI port note: Pd doesn't seem to be able to find the following libs
# unless they are in $(DESTDIR)$(bindir) instead of $(DESTDIR)$(prefix).
# I figured that out by trial and error. If a Windows expert wants to figure
# out a better way to do it, that's fine-- I'm just trying to get it to build
# at all at this point...
95 96
	install -d $(DESTDIR)$(prefix)/
	install -d $(DESTDIR)$(bindir)
97 98 99 100 101 102 103 104
	install -p $(bin_src)/libfftw3-3.dll  $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libfftw3f-3.dll  $(DESTDIR)$(bindir)/
	#install -p $(bin_src)/libgnurx-0.dll  $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libogg-0.dll  $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libsndfile-1.dll  $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libvorbis-0.dll  $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libvorbisenc-2.dll  $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libvorbisfile-3.dll  $(DESTDIR)$(bindir)/
105
	install -p $(bin_src)/libmp3lame-0.dll  $(DESTDIR)$(bindir)/
Albert Gräf's avatar
Albert Gräf committed
106
ifneq ($(LIGHT),yes)
107 108 109 110
	# I think these two are needed for zexy/matchbox and zexy/regex
	install -p $(bin_src)/libsystre-0.dll $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libtre-5.dll $(DESTDIR)$(bindir)/
	# For fluid~
111
	install -p $(bin_src)/libfluidsynth-2.dll $(DESTDIR)$(bindir)/
112
	# For other external libs
113 114
	install -p $(bin_src)/lua53.dll          $(DESTDIR)$(bindir)/
	#install -p $(bin_src)/pthreadGC2.dll     $(DESTDIR)$(bindir)/
Jonathan Wilkes's avatar
Jonathan Wilkes committed
115
	install -p $(bin_src)/libdl.dll     $(DESTDIR)$(bindir)/
116 117
	install -p $(bin_src)/libportaudio-2.dll     $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libFLAC-8.dll     $(DESTDIR)$(bindir)/
118
	install -p $(bin_src)/libspeex-1.dll     $(DESTDIR)$(bindir)/
119 120 121 122 123 124 125 126 127 128
        # These are for Gem
	install -p $(bin_src)/libftgl-2.dll $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libfreetype-6.dll $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libbz2-1.dll $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libharfbuzz-0.dll $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libglib-2.0-0.dll $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libintl-8.dll $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libiconv-2.dll $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libpng16-16.dll $(DESTDIR)$(bindir)/
	install -p $(bin_src)/zlib1.dll $(DESTDIR)$(bindir)/
129 130
	install -p $(bin_src)/libpcre-1.dll $(DESTDIR)$(bindir)/
	install -p $(bin_src)/libgraphite2.dll $(DESTDIR)$(bindir)/
131
	install -p $(bin_src)/libjpeg-8.dll $(DESTDIR)$(bindir)/
132 133 134 135 136 137 138
	# Apparently these Gem dependencies must be in the bindir
	# to be found on Windows
	-install -p $(DESTDIR)/extra/Gem/gem_film*.dll $(DESTDIR)$(bindir)/
	-install -p $(DESTDIR)/extra/Gem/gem_image*.dll $(DESTDIR)$(bindir)/
	-install -p $(DESTDIR)/extra/Gem/gem_model*.dll $(DESTDIR)$(bindir)/
	-install -p $(DESTDIR)/extra/Gem/gem_record*.dll $(DESTDIR)$(bindir)/
	-install -p $(DESTDIR)/extra/Gem/gem_video*.dll $(DESTDIR)$(bindir)/
Albert Gräf's avatar
Albert Gräf committed
139
endif
140
# these stay with pd.exe
141 142 143
# if these are installed, include them in the build root
	-install -p $(system32)/msvcp71.dll   $(DESTDIR)$(bindir)
	-install -p $(system32)/msvcr71.dll   $(DESTDIR)$(bindir)
144
	#-install -p $(system32)/pthreadVC.dll $(DESTDIR)$(bindir)
145 146 147
	install -p $(bin_src)/libwinpthread-1.dll $(DESTDIR)$(bindir)
	install -p $(bin_src)/libgcc_s_dw2-1.dll $(DESTDIR)$(bindir)
	install -p $(bin_src)/libstdc++-6.dll $(DESTDIR)$(bindir)
Albert Gräf's avatar
Albert Gräf committed
148
ifneq ($(LIGHT),yes)
149 150 151
# lyonpotpourri compiles its own shared lib. On Windows it needs to be
# in the path of the pd executable in order to get loaded. (There's probably
# also a way to add the external lib's path but I don't know how to do that.)
152
	install -p $(DESTDIR)/extra/lyonpotpourri/liblyonpotpourri.dll $(DESTDIR)$(bindir)
153 154
# fftease also uses a shared lib...
	install -p $(DESTDIR)/extra/fftease/libfftease.dll $(DESTDIR)$(bindir)
Albert Gräf's avatar
Albert Gräf committed
155
endif
156 157 158 159 160 161 162 163 164 165


exe_install:
	install -d $(DESTDIR)$(bindir)

$(PD_INNO_SETUP): $(PD_INNO_SETUP).in
	@echo "Making Inno Setup file: $(PD_INNO_SETUP)"
	cat "$(PD_INNO_SETUP).in" | \
		sed 's/PACKAGE_NAME/$(PACKAGE_NAME)/g' | \
		sed 's/PD_VERSION/$(PD_VERSION)/g' | \
166
		sed 's/PD_BUILD_VERSION/$(PD_BUILD_VERSION)/g' > \
167
		$(PD_INNO_SETUP)
168 169 170
# in incremental builds the lib directory may not exist, in that case we need
# to edit the setup file to prevent an inno-setup error
	test -d $(DESTDIR)$(libdir) || sed -i -e 's/^Source: build\\lib/;Source: build\\lib/' $(PD_INNO_SETUP)
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
#	start $(PD_INNO_SETUP)


#==============================================================================#
#
## CLEAN TARGETS
#
#==============================================================================#

distclean: package_clean
	$(MAKE) -C $(packages_src) $(DEST_PATHS) distclean


package_clean: 	
	-rm $(PD_INNO_SETUP)
	-rm -rf $(DESTDIR)
	-rm -rf Output


clean: package_clean
	$(MAKE) -C $(packages_src) $(DEST_PATHS) clean

#==============================================================================#
#
## TEST TARGETS
#
#==============================================================================#

test_package:
	echo "No tests here yet"


test_locations:
	@echo --------------------------------------------------
	@echo "PD_VERSION: $(PD_VERSION)"
206
	@echo "PD_BUILD_VERSION: $(PD_BUILD_VERSION)"
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
	@echo "CWD $(CWD)"
	@echo "DESTDIR $(DESTDIR)"
	@echo "PREFIX $(prefix)"
	@echo "BINDIR  $(bindir)"
	@echo "LIBDIR  $(libdir)"
	@echo "OBJECTSDIR  $(objectsdir)"
	@echo "PDDOCDIR  $(pddocdir)"
	@echo "LIBPDDIR  $(libpddir)"
	@echo "LIBPDBINDIR  $(libpdbindir)"
	@echo "HELPDIR  $(helpdir)"
	@echo "MANUALSDIR  $(manualsdir)"
	@echo "EXAMPLESDIR  $(examplesdir)"
	@echo --------------------------------------------------
	autoconf --version
	@echo --------------------------------------------------
	make --version
	@echo --------------------------------------------------
	gcc --version


.PHONY: all install package clean distclean test_locations test_package exe_install