pre-announce: MELT 0.9.5rc1 plugin for GCC 4.6 & 4.7 pre-release candidate 1 (and help needed on make issues)
Basile Starynkevitch
basile@starynkevitch.net
Thu Mar 29 20:02:00 GMT 2012
Hello All,
The pre-release candidate 1 of MELT 0.9.5 is available for testing on
http://gcc-melt.org/melt-0.9.5rc1-plugin-for-gcc-4.6-or-4.7.tar.gz
as a gzipped tar archive of 4473286 bytes and md5sum ae00b9bd31f481e1bbc406711ca4c2f4.
extracted from MELT branch 185969, march 29th 2012
You could try building it e.g. with
make MELTGCC=gcc-4.7 GCCMELT_CC=gcc-4.7
It seems to be also buildable for GCC 4.6 with
make MELTGCC=gcc-4.6 GCCMELT_CC=gcc-4.6
(both commands sort of work, with perhaps minor issues very late in the build process;
I'm not very afraid of these)
But I'm trying to code a makefile which would autodetect in GCC 4.7 was compiled in C++
mode (or if the GCC was compiled in C mode, then it is probably a 4.6 or a 4.7
configured in a weird fashion).
So far I tried to code in my Makefile the following trick
############################################################################
## the compiler with which melt.so is used
ifndef MELTGCC
MELTGCC = $(or $(CC),gcc)
endif
## gives yes if MELTGCC has been built with C++ or else the empty string
MELTGCC_BUILD_WITH_CXX = $(shell grep -q 'define +ENABLE_BUILD_WITH_CXX +1' \
`$(MELTGCC) -print-file-name=plugin/include/auto-host.h` && echo yes)
## The compiler and flags used to build the melt.so plugin and to
## compile MELT generated code. Notice that melt-module.mk use the
## same Make variables. For a melt plugin to GCC 4.7 or later, that
## could be a C++ compiler! eg
## make MELTGCC=gcc-4.7 GCCMELT_CC=g++-4.7
## hence we add a test if $(MELTGCC) was built with C++ or with C
ifeq ($(strip $(MELTGCC_BUILD_WITH_CXX)),)
GCCMELT_CC ?= $(or $(CC),gcc) -Wc++-compat
else
GCCMELT_CC ?= $(or $(CXX),g++)
endif
GCCMELT_CFLAGS ?= -g -O -Wall
$(info MELT plugin for MELTGCC= $(MELTGCC) to be compiled with GCCMELT_CC= $(GCCMELT_CC) \
flags $(GCCMELT_CFLAGS) $(if $(MELTGCC_BUILD_WITH_CXX),built with C++ \
$(MELTGCC_BUILD_WITH_CXX)))
### rest of makefile skipped
#############################################################################
but for some reason it does not work. (Maybe a := versus = make variable thing).
Do you have any suggestions about such things? Assuming a plugin whose source code
should work with both 4.6 & 4.7, how would you autodetect if GCC was compiled in C++ or
in C mode? What am I doing wrong?
Regards.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***
More information about the Gcc
mailing list