[Pdmtl] Compilation d'externes pd sous OS X
Thomas O Fredericks
iamonthebeach at gmail.com
Lun 11 Oct 12:13:29 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).
Euh, ouais, sauf que le ALL c'est moi qui l'a fait et �a marche pas... j'avais oubli� de vous le dire :)
J'ai chang� la ligne pour la suivante:
ALL = $(patsubst %.c,%.$(EXTENSION),$(wildcard *.c))
Et maintenant �a marche si je tape "make" tout seul. Mais je suis encore oblig� de taper "make alpha.pd_darwin" si je veux juste compiler alpha.
> je suis vraiment pas un expert en makefile et compilation, mais si tu fais make alpha c'est pas une application, c'est juste la m�me chose que alpha.pd_darwin. donc, tu pourrais ajouter un mv dans la section ### C++ files
Quand je tape "make alpha" cela cr�e vraiment une genre d'application (et non une lib pd_darwin) avec des directives tir�es du n�ant (c'est � dire � partir de directives que je n'ai pas d�fini)! Je crois qu'il y a des directives par d�faut dans Make et lorsque je tape "make alpha" cela ex�cute les directives par d�faut.
Thomas
>>
>>
>>
>> #
>> # 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