[Pdmtl] Compilation d'externes pd sous OS X

Martin Peach martin.peach at sympatico.ca
Lun 11 Oct 12:01:10 EDT 2010


Je crois q'avec ce Makefile t'as besoin de taper 'make' et c'est tout. 
Si ton UNAME éqale 'Darwin', l'extension des produits devient 
'pd_darwin'. Le défaut sans arguments devient ALL, qui trouve et compile 
tous les fichiers avec l'extension '.c' dans le dossier (seulement ceux 
qui était modifiés depuis la dernier compilation).

Martin


On 2010-10-11 11:21, Thomas O Fredericks wrote:
> Ok, je me suis basé sur le Makefile de pd-extended.
>
> Voir à la fin de ce courriel pour voir le fichier. Il y a trois paramètres à déterminer: PD_SRC, PD_BIN et OUTPUT.
>
> Le fichier marche très bien, sauf qu'il y a quelques petits irritants.
> Disons que mon dossier contient les fichiers "Makefile alpha.c beta.c".
> 1) Pour compiler l'externe "alpha", je dois tapper "make alpha.pd_darwin". Comment puis-je modifier mon fichier pour tapper "make alpha.c" ou "make alpha"? Pour l'instant, si je tappe "make alpha", le fichier est compilé en tant qu'application.
> 2) Je voudrais que le "default:" du Makefile soit déduit automatiquement à partir des fichiers qui se trouvent dans le dossier (alpha.c beta.c). Comment puis-je faire pour que le default compile automatiquement tous mes fichiers en externes?
>
> Merci.
>
> Thomas
>
>
>
> --------------
> Makefile
> --------------
>
> #
> # SETUP
> #
>
> # Points to the folder that contains pd's /src dir
> PD_SRC = ../../../pd
>
> # Points to the folder that contains pd's compiled /bin dir (for OS X)
> PD_BIN = /Applications/Pd-extended.app/Contents/Resources
>
> # Points to the folder to which you want to move the built file
> OUTPUT = ~/Make/pd/tof
>
>
> #
> # FIND OS
> #
>
> UNAME := $(shell uname -s)
> ifeq ($(UNAME),Linux)
>    OS_NAME = linux
>    EXTENSION = pd_linux
>    DYLIB_EXTENSION = so
> endif
> ifeq ($(UNAME),Darwin)
>    OS_NAME = darwin
>    EXTENSION = pd_darwin
>    DYLIB_EXTENSION = dylib
> endif
> ifeq (MINGW,$(findstring MINGW,$(UNAME)))
>    OS_NAME = windows
>    EXTENSION = dll
>    DYLIB_EXTENSION = dll
> endif
> ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
>    OS_NAME = windows
>    EXTENSION = dll
>    DYLIB_EXTENSION = dll
> endif
> # which CPU to compile for
> UNAME_MACHINE := $(shell uname -m)
> ifeq ($(UNAME_MACHINE),i386)
>    ARCH = i386
> endif
> ifeq ($(UNAME_MACHINE),i686)
>    ARCH = i386
> endif
> ifeq ($(UNAME_MACHINE),ppc)
>    ARCH = powerpc
> endif
>
>
>
> #
> # COMPILE OPTIONS
> #
>
> CWD := $(shell pwd)
>
>
> # turn on weak linking and dlopen support
> export MACOSX_DEPLOYMENT_TARGET = 10.3
>
> # DEFAULT TARGET # Find a way to list all c files target
> ALL = $((patsubst %.c,%.o,$(wildcard *.c)))
> default: $(ALL)
>
> .SUFFIXES: .$(EXTENSION) .$(SHARED_LIB)
>
>
> # this variable is to support old "win" directories, rather than "windows"
> BUILDSRC_OS_NAME = $(OS_NAME)
>
> CFLAGS = -DPD -I$(PD_SRC)/src -Wall -W $(DEBUG_CFLAGS)
> LDFLAGS =
> LIBS = -lm
>
> ifeq ($(OS_NAME),darwin)
> # 10.4 Tiger
>    FAT_FLAGS = -arch ppc -arch ppc64 -arch i386
> # 10.5 Leopard
> #  FAT_FLAGS = -arch ppc -arch ppc7400 -arch ppc64 -arch i386 -arch x86_64
>    CFLAGS += -I/sw/include -DMACOSX -DUNIX -Dunix -DDL_OPEN -arch $(ARCH)
>    LDFLAGS += -bundle -bundle_loader $(PD_BIN)/bin/pd -undefined dynamic_lookup \
> 		-L/sw/lib -weak_framework Carbon -arch $(ARCH)
>    LIBS += -lc
>    DYLIB_LDFLAGS = -dynamiclib -undefined dynamic_lookup -read_only_relocs warning -L/sw/lib
>    STRIP = strip -x
> endif
> ifeq ($(OS_NAME),linux)
>    CFLAGS +=  -DUNIX -Dunix -DDL_OPEN -fPIC
>    LDFLAGS += -Wl,--export-dynamic  -shared -fPIC
>    LIBS += -lc
>    DYLIB_LDFLAGS = $(LDFLAGS)
>    STRIP = strip --strip-unneeded -R .note -R .comment
> endif
> ifeq ($(OS_NAME),windows)
>    BUILDSRC_OS_NAME = win
>    WINDOWS_HACKS = -D'O_NONBLOCK=1' -D'srand48(n)=srand((n))' \
>      -D'drand48()=((double)rand()/RAND_MAX)' -D'bzero(p,n)=memset(p,0,n)'
> # These don't seem to be needed:
> #	-D'PROT_READ=1' \
> #	-D'MAP_PRIVATE=2' \
> #	-D'O_NDELAY=O_NONBLOCK'
>    CFLAGS += -mms-bitfields -DMSW -DNT $(WINDOWS_HACKS)
>    LDFLAGS += -s -shared
> # all of these included libs are part of libc in UNIX platforms.  All except
> # libregex are in DLLs, so they get stripped from the external's .dll binary
>    LIBS += -L$(PD_SRC)/src -L$(PD_SRC)/bin -L$(PD_SRC)/obj -lpd \
>      -lwsock32 -liphlpapi -lpthreadGC2 -lkernel32 -luser32 -lgdi32 -lregex
>    DYLIB_LDFLAGS = -shared
>    STRIP = strip --strip-unneeded -R .note -R .comment
> endif
>
> CXXFLAGS = $(CFLAGS)
>
> ### C++ files
> %.$(EXTENSION): %.cpp
> %.$(EXTENSION): %.cc
> 	$(CXX) $(OPT_CFLAGS) $(CXXFLAGS) -o "$*.o" -c "$<"
> 	$(CXX) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS)
> 	chmod a-x "$*.$(EXTENSION)"
> #	$(STRIP) $*.$(EXTENSION)
> #	rm -f -- $*.o
> 	mv $*.$(EXTENSION) $(OUTPUT)
>
> %.o: %.cpp
> %.o: %.cc
> 	$(CXX) $(OPT_CFLAGS) $(CXXFLAGS) -o "$*.o" -c "$<"
>
>
> ### C files
> %.o: %.c
> 	$(CC) $(OPT_CFLAGS) $(CFLAGS) -o "$*.o" -c "$*.c"
>
> %.$(EXTENSION): %.o
> 	$(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o"  $(LIBS) \
> 		`test -f $*.libs&&  cat $*.libs`	\
> 		`my_dylib=$(patsubst $(externals_src)/%,%,$(@D)); test -f $(@D)/lib$${my_dylib}.$(DYLIB_EXTENSION)&&  echo -L$(@D) -l$$my_dylib` \
> 		`my_obj=$(patsubst $(externals_src)/%,%,$(@D)); test -f $(@D)/shared/$${my_obj}.o&&  echo $(@D)/shared/$${my_obj}.o` \
> 		`test -f $(dir $*)../$(BUILDSRC_OS_NAME)/$(notdir $*).libs&&  \
> 			cat $(dir $*)../$(BUILDSRC_OS_NAME)/$(notdir $*).libs`
> 	chmod a-x "$*.$(EXTENSION)"
> 	$(STRIP) $*.$(EXTENSION)
> 	rm -f -- $*.o
> 	mv $*.$(EXTENSION) $(OUTPUT)
>
>
>
>
>
>
>
> _______________________________________________
> Pdmtl mailing list
> Pdmtl at lists.artengine.ca
> http://lists.artengine.ca/cgi-bin/mailman/listinfo/pdmtl
>
>



Plus d'informations sur la liste de diffusion Pdmtl