Thank you for replying fast,
----- "Hans-Christoph Steiner" hans@at.or.at a écrit :
The current template is setup for only C, but it should be easy enough
to adapt it. Mostly just change references to .c to .cpp (or .cc or .cxx or one of the far too many C++ file extensions). Then change
references from CC to CXX and CFLAGS to CXXFLAGS. But you might not
even need to do that.
If I don't do that it keeps saying
make: Nothing to be done for `all'
also I've added
CXX=g++
because i'm using mingw, and it starts compile :)
Now the Makefile doesn't provide pd/src files I need to include, so for getting it I had to make another hack
# PD_INCLUDE = $(PD_PATH)/include/pd PD_INCLUDE = $(PD_PATH)/src
and
# PD_PATH = $(shell cd "$$PROGRAMFILES/pd" && pwd) PD_PATH = ../../../pd
then it compiles fine but would this work on another platform?
maybe you could give a try?
http://sourceforge.net/projects/patco/files/proll/
.hc
On Oct 13, 2011, at 3:47 PM, Patrice Colet wrote:
Hello is the makefile template able to compile with cpp source files, and how?
-- Patrice Colet
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
"It is convenient to imagine a power beyond us because that means we
don't have to examine our own lives.", from "The Idols of Environmentalism", by Curtis White
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-10-15 04:08, Patrice Colet wrote:
also I've added
CXX=g++
because i'm using mingw, and it starts compile :)
hmm, what is the default for CXX on mingw?
i think it's a bad idea to hardcode the used compiler for no compelling reason.... ...ah after inspecting the template/Makefile, it seems that CC is set explicitely as well. so does MinGW's make indeed does not use a working compiler in CC/CXX?
fgmasdr IOhannes
Hello IOhannes,
all I could say is this:
$ make -p -n | grep CXX make: *** No targets specified and no makefile found. Stop. LINK.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c CXX = g++
There another thing very unlikely in template/Makefile, if do a 'make clean', it removes all the sources as well as objects and binaries so for not loosing sources I have to remove these lines:
-rm -f -- $(SOURCES:.cpp=.o) $(SOURCES_LIB:.cpp=.o) $(SHARED_SOURCE:.cpp=.o) -rm -f -- $(SOURCES:.cpp=.$(EXTENSION))
----- Mail original ----- De: "IOhannes m zmoelnig" zmoelnig@iem.at À: "pd-dev" pd-dev@iem.at Envoyé: Lundi 17 Octobre 2011 09:19:06 Objet: Re: [PD-dev] makefile template
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-10-15 04:08, Patrice Colet wrote:
also I've added
CXX=g++
because i'm using mingw, and it starts compile :)
hmm, what is the default for CXX on mingw?
i think it's a bad idea to hardcode the used compiler for no compelling reason.... ...ah after inspecting the template/Makefile, it seems that CC is set explicitely as well. so does MinGW's make indeed does not use a working compiler in CC/CXX?
fgmasdr IOhannes
_______________________________________________ Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-10-17 17:11, Patrice Colet wrote:
Hello IOhannes,
all I could say is this:
$ make -p -n | grep CXX make: *** No targets specified and no makefile found. Stop. LINK.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c CXX = g++
what do you mean by that? why does it mean that you have to manually add a "CXX=g++" line to your Makefile? here (on linux), i get approximately the same. note that there is a line "CXX = g++" is the following output, though this is set implicitely by make and not explicitely in the makefile.
<snip> $ make -p -n | grep CXX ALL_CXXFLAGS := -I"/usr/include/pd" -DPD -DVERSION='"0.0"' -fPIC -Wall - -W -g -O6 -funroll-loops -fomit-frame-pointer CXXFLAGS = -Wall -W -g LINK.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) OPT_CXXFLAGS = -O6 -funroll-loops -fomit-frame-pointer COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c CXX = g++ $(CXX) $(ALL_CXXFLAGS) -o "$*.o" -c "$*.cpp" $(CXX) $(ALL_LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(ALL_LIBS) $(SHARED_LIB) $(CXX) $(ALL_LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(ALL_LIBS) $(SHARED_LIB) $(CXX) $(ALL_LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.cpp=.o) $(LIBRARY_NAME).o $(ALL_LIBS) @echo "CXX: $(CXX)" @echo "CXXFLAGS: $(CXXFLAGS)" @echo "ALL_CXXFLAGS: $(ALL_CXXFLAGS)" $(CXX) $(ALL_CXXFLAGS) -o "$*.o" -c "$*.cpp" </snip>
There another thing very unlikely in template/Makefile, if do a 'make clean', it removes all the sources as well as objects and binaries so for not loosing sources I have to remove these lines:
-rm -f -- $(SOURCES:.cpp=.o) $(SOURCES_LIB:.cpp=.o) $(SHARED_SOURCE:.cpp=.o) -rm -f -- $(SOURCES:.cpp=.$(EXTENSION))
then you did something weird :-) i had the same problem after changing CC to CXX and replacing myobject.c with myobject.cpp
the template/Makefile is full of assumptions that the sources end with ".c"; to compile .cpp files, you will have to replace all the pattern substitutions throughout the makefile from %.c to %.cpp mainly you will find this in constructs like "$(SOURCES:.c=.o)" which need to be changed to "$(SOURCES:.cpp=.o)"
fgmasdr IOhannes
On Oct 17, 2011, at 12:08 PM, IOhannes m zmoelnig wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-10-17 17:11, Patrice Colet wrote:
Hello IOhannes,
all I could say is this:
$ make -p -n | grep CXX make: *** No targets specified and no makefile found. Stop. LINK.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c CXX = g++
what do you mean by that? why does it mean that you have to manually add a "CXX=g++" line to your Makefile? here (on linux), i get approximately the same. note that there is a line "CXX = g++" is the following output, though this is set implicitely by make and not explicitely in the makefile.
<snip> $ make -p -n | grep CXX ALL_CXXFLAGS := -I"/usr/include/pd" -DPD -DVERSION='"0.0"' -fPIC -Wall - -W -g -O6 -funroll-loops -fomit-frame-pointer CXXFLAGS = -Wall -W -g LINK.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) OPT_CXXFLAGS = -O6 -funroll-loops -fomit-frame-pointer COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c CXX = g++ $(CXX) $(ALL_CXXFLAGS) -o "$*.o" -c "$*.cpp" $(CXX) $(ALL_LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(ALL_LIBS) $(SHARED_LIB) $(CXX) $(ALL_LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(ALL_LIBS) $(SHARED_LIB) $(CXX) $(ALL_LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.cpp=.o) $(LIBRARY_NAME).o $(ALL_LIBS) @echo "CXX: $(CXX)" @echo "CXXFLAGS: $(CXXFLAGS)" @echo "ALL_CXXFLAGS: $(ALL_CXXFLAGS)" $(CXX) $(ALL_CXXFLAGS) -o "$*.o" -c "$*.cpp" </snip>
MinGW does not include a 'cc.exe' only a 'gcc.exe'. CC defaults to 'cc', so for what we are doing, it makes sense to do CC=gcc. It looks like MinGW's default CXX is g++ and MinGW includes a 'g++.exe' so there is no need to set CXX in the Makefile.
There another thing very unlikely in template/Makefile, if do a 'make clean', it removes all the sources as well as objects and binaries so for not loosing sources I have to remove these lines:
-rm -f -- $(SOURCES:.cpp=.o) $(SOURCES_LIB:.cpp=.o) $ (SHARED_SOURCE:.cpp=.o) -rm -f -- $(SOURCES:.cpp=.$(EXTENSION))
then you did something weird :-) i had the same problem after changing CC to CXX and replacing myobject.c with myobject.cpp
the template/Makefile is full of assumptions that the sources end with ".c"; to compile .cpp files, you will have to replace all the pattern substitutions throughout the makefile from %.c to %.cpp mainly you will find this in constructs like "$(SOURCES:.c=.o)" which need to be changed to "$(SOURCES:.cpp=.o)"
Yes, that's what's causing everything to get deleted. Basically ".c=.o" means replace a ".c" ending with ".o". If there isn't a ".c" ending, it just passes the values thru unchanged. Since the myobject.cpp doesn't end in ".c", it passes thru unchanged, and therefore 'make clean' is deleting myobject.cpp rather than myobject.o.
.hc
----------------------------------------------------------------------------
Looking at things from a more basic level, you can come up with a more direct solution... It may sound small in theory, but it in practice, it can change entire economies. - Amy Smith
Hello,
It's difficult to follow, let me try to explain why...
----- Mail original -----
De: "Hans-Christoph Steiner" hans@at.or.at À: "IOhannes m zmoelnig" zmoelnig@iem.at Cc: "pd-dev" pd-dev@iem.at Envoyé: Lundi 17 Octobre 2011 18:33:45 Objet: Re: [PD-dev] makefile template
On Oct 17, 2011, at 12:08 PM, IOhannes m zmoelnig wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-10-17 17:11, Patrice Colet wrote:
Hello IOhannes,
all I could say is this:
$ make -p -n | grep CXX make: *** No targets specified and no makefile found. Stop. LINK.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c CXX = g++
what do you mean by that? why does it mean that you have to manually add a "CXX=g++" line to your Makefile?
no it just mean that g++ is the default compiler assigned to CXX variable in my environment, implicitly set by make as you mentioned below, maybe I misunderstood your question in precedent mail.
here (on linux), i get approximately the same. note that there is a line "CXX = g++" is the following output, though this is set implicitely by make and not explicitely in the makefile.
MinGW does not include a 'cc.exe' only a 'gcc.exe'. CC defaults to 'cc', so for what we are doing, it makes sense to do CC=gcc. It looks like MinGW's default CXX is g++ and MinGW includes a 'g++.exe' so there is no need to set CXX in the Makefile.
Yes indeed, I've commented out CC=gcc for having compilation running fine.
There another thing very unlikely in template/Makefile, if do a 'make clean', it removes all the sources as well as objects and binaries so for not loosing sources I have to remove these lines:
-rm -f -- $(SOURCES:.cpp=.o) $(SOURCES_LIB:.cpp=.o) $ (SHARED_SOURCE:.cpp=.o) -rm -f -- $(SOURCES:.cpp=.$(EXTENSION))
then you did something weird :-) i had the same problem after changing CC to CXX and replacing myobject.c with myobject.cpp
the template/Makefile is full of assumptions that the sources end with ".c"; to compile .cpp files, you will have to replace all the pattern substitutions throughout the makefile from %.c to %.cpp mainly you will find this in constructs like "$(SOURCES:.c=.o)" which need to be changed to "$(SOURCES:.cpp=.o)"
that's what I did, after changing all .c to .cpp and CC to CXX it compiles.
Yes, that's what's causing everything to get deleted. Basically ".c=.o" means replace a ".c" ending with ".o". If there isn't a ".c" ending, it just passes the values thru unchanged. Since the myobject.cpp doesn't end in ".c", it passes thru unchanged, and therefore 'make clean' is deleting myobject.cpp rather than myobject.o.
that's right, if I replace .c with .cpp in clean method, make doesn't remove .cpp files anymore, but it still removes the .tcl files
so I come with another question :D
how .tcl files could remain after clean method?
Also I still have same question about pd includes, but more accurately...
gui externals needs m_imp.h, because of this:
sys_vgui("eval [read [open {%s/%s.tcl}]]\n", proll_class->c_externdir->s_name, proll_class->c_name->s_name); sys_vgui("::patco::proll::setup %s\n", proll_receive_symbol->s_name);
c_externdir->s_name and c_name->s_name are declared in m_imp.h but it's not in pd/include, there only is m_pd.h.
So do I have to add this file to my project or, do I have to modify the Makefile to look for it? For the moment I keep a copy of m_imp.h in my project it's easier to handle ^^.
I will send a message to pd-list when the external will be ready for a test on other platforms, this one might be worth to be included into pdx distribution.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-10-18 05:01, Patrice Colet wrote:
Hello,
no it just mean that g++ is the default compiler assigned to CXX variable in my environment, implicitly set by make as you mentioned below, maybe I misunderstood your question in precedent mail.
or maybe i did :-) anyhow, i guess we can mark this part of the conversation as "resolved".
fgmasdr IOhannes
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-10-18 05:01, Patrice Colet wrote:
then you did something weird :-) i had the same problem after changing CC to CXX and replacing myobject.c with myobject.cpp
the template/Makefile is full of assumptions that the sources end with ".c"; to compile .cpp files, you will have to replace all the pattern substitutions throughout the makefile from %.c to %.cpp mainly you will find this in constructs like "$(SOURCES:.c=.o)" which need to be changed to "$(SOURCES:.cpp=.o)"
that's what I did, after changing all .c to .cpp and CC to CXX it compiles.
[...]
that's right, if I replace .c with .cpp in clean method, make doesn't remove .cpp files anymore, but it still removes the .tcl files
that is why i said 'constructs _like_ "$(SOURCES:.c=.o)"' rather than 'replace all occurences of ".c=.o" with ".cpp=.o"'
you really should go through the _entire_ Makefile and search for all ".c" (indicating filename suffixes...so check the context) and replace it with ".cpp". there might be occurences of ".c" that are not related to filename extensions so take care.
fgmasdr IOhannes
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-10-18 05:01, Patrice Colet wrote:
Also I still have same question about pd includes, but more accurately...
i missed that question :-)
gui externals needs m_imp.h, because of this:
[...]
c_externdir->s_name and c_name->s_name are declared in m_imp.h but it's not in pd/include, there only is m_pd.h.
where did you get the "pd/include" from? i don't have it on my system.
So do I have to add this file to my project or, do I have to modify the Makefile to look for it? For the moment I keep a copy of m_imp.h in my project it's easier to handle ^^.
you should definitely NOT keep it in your project. unlike m_pd.h, m_imp.h is a private header, things in there might change significantly from release to release. this is not an empty threat, changes in the private header files are the reason why some nifty (mainly gui related) externals compiled with 0.41 will crash when used on 0.42.
so if you must include m_imp.h, you should always use the one that comes with the version of Pd that it relates to. therefore you must tell the buld process where it should look for those headers. in template/Makefile, this is done via the "PD_INCLUDE" variable. it defaults to something like /usr/local/include/pd (ah, i guess your "pd/include" above was meant to be "include/pd"?), which is where headers are expected on un*x like systems adhering to the FSS. w32 does not really care about FSS, hence the default doesn't really work.
there are a couple of workarounds to get your build going: set the PD_INCLUDE to the path of your Pd-headers (or sources) when building. something like: $ make PD_INCLUDE=/c/cygdrive/Programmas/Pd/src should do the trick. afair, the Pd-extended nightly builds will set the PD_INCLUDE to point to the correct path automatically.
if this is too much annoying during the test phase and if you are working from a "standard layout" (with Pd-sources in ..../pd/src and your external in ..../externals/yourexternal) you might _additionally_ add "../../pd/src" to the includes in ALL_CXXFLAGS _after_ PD_INCLUDE. something like Makefile:57 ALL_CFLAGS = -I"$(PD_INCLUDE)" -I../../pd/src
it should be after the PD_INCLUDE so that the user can point PD_INCLUDE to the directory with the correct m_imp.h, and use ../../pd/src only as fallback.
fgamdr IOhannes
----- Mail original -----
De: "IOhannes m zmoelnig" zmoelnig@iem.at À: pd-dev@iem.at Envoyé: Mardi 18 Octobre 2011 08:49:12 Objet: Re: [PD-dev] makefile template
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-10-18 05:01, Patrice Colet wrote:
c_externdir->s_name and c_name->s_name are declared in m_imp.h but it's not in pd/include, there only is m_pd.h.
where did you get the "pd/include" from? i don't have it on my system.
In pd-extended-0.43 release there is an include folder, and that explain why there is this line
PD_PATH = $(shell cd "$$PROGRAMFILES/pd" && pwd)
for getting pd path, and this line
PD_INCLUDE = $(PD_PATH)/include/pd
for pd include, maybe we aren't talking about the same template, I've got mine from 0.43/external/template
On Oct 18, 2011, at 1:23 PM, Patrice Colet wrote:
----- Mail original -----
De: "IOhannes m zmoelnig" zmoelnig@iem.at À: pd-dev@iem.at Envoyé: Mardi 18 Octobre 2011 08:49:12 Objet: Re: [PD-dev] makefile template
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-10-18 05:01, Patrice Colet wrote:
c_externdir->s_name and c_name->s_name are declared in m_imp.h but it's not in pd/include, there only is m_pd.h.
where did you get the "pd/include" from? i don't have it on my system.
In pd-extended-0.43 release there is an include folder, and that explain why there is this line
PD_PATH = $(shell cd "$$PROGRAMFILES/pd" && pwd)
for getting pd path, and this line
PD_INCLUDE = $(PD_PATH)/include/pd
for pd include, maybe we aren't talking about the same template, I've got mine from 0.43/external/template
Pd-extended includes pd/include on Mac OS X and Windows, as well as pd/ include/pd and pd/include/pdextended. $PROGRAMFILES/pd/include/pd should include m_imp.h, its a bug if not.
.hc
----------------------------------------------------------------------------
¡El pueblo unido jamás será vencido!