On Mon, 9 Jul 2007, Kasper Daniel Hansen wrote:
> Hi
>
> This is a question prompted by the mac version of R, but as I see it,
> it should have broader interest.
>
> These days the CRAN Mac binary per default compiles every package for
> two architectures. First i386 and then ppc. In between the two
> compilation runs, any object files in pkgname/src is removed. This
> cleanup is necessary since otherwise Make would not recompile the
> object files under the next architecture.
>
> I have a package which includes a large SDK which I have put in
> src/fusion_sdk
> (and subdirectories). I take care of that by using a Makevars file
> with essentially (the whole Makevars file is reproduced below)
>
> PKG_SOURCES = \
> fusion_sdk/calvin_files/data/src/CDFData.cpp
>
> OBJS=$(PKG_SOURCES:.cpp=.o)
>
> all: $(SHLIB)
>
> However, this setup does not remove the object files in the
> fusion_sdk subdirectory. From a posting on R-sig-mac by Simon Urbanek
> I learned that I need to clean up these directories myself.
>
> I have - per R extensions - attempted to do so using a pkgname/
> cleanup script. While this works for cleaning up the sub directories
> when I do R CMD build, it seems as if this script is not being run
> between compilation runs (is this intentional btw.?).
What do you mean by 'compilation runs'? The 'cleanup' script
will be run
by R CMD INSTALL --cleanup (and without --cleanup it is intentionally not
run).
> So my question is now: how do I in a simple way clean up my
> subdirectories? I would prefer it to be as simple as possible because
> so far I have not really needed anything besides a Makevars file. In
> fact the impression I have right now from looking at the SHLIB and
> INSTALL scripts is that I might need a Makefile that removes the
> object files _before_ starting the compilation, as I don't really see
> any cleanup process (eg. making a target clean) - but this may very
> well be due to my limited understanding of these scripts.
I see R CMD INSTALL --clean that runs a clean up afterwards, and 2.6.0
will also have R CMD INSTALL --preclean in case you forgot --clean on the
last run.
> Any help/hints on how to proceed? Especially if I want it to be
> portable?
What does R CMD INSTALL --clean not do that you want?
If you are talking about R CMD SHLIB, that currently does not clean up but
this has been raised and it will most likely have a --clean option in
2.6.0 that removes $(OBJECTS).
>
> Kasper
>
> The full Makevars file:
>
> MYCXXFLAGS=-O0
You do realize that is highly non-portable?
> %.o: %.cpp
> $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(MYCXXFLAGS) -c $< -o $@
>
> PKG_CPPFLAGS=\
> -imacros R_affx_constants.h\
> -Ifusion_sdk/calvin_files/array/src\
> -Ifusion_sdk/calvin_files/data/src\
> -Ifusion_sdk/calvin_files/exception/src\
> -Ifusion_sdk/calvin_files/fusion/src\
> -Ifusion_sdk/calvin_files/fusion/src/GCOSAdapter\
> -Ifusion_sdk/calvin_files/fusion/src/CalvinAdapter\
> -Ifusion_sdk/calvin_files/parameter/src\
> -Ifusion_sdk/calvin_files/parsers/src\
> -Ifusion_sdk/calvin_files/portability/src\
> -Ifusion_sdk/calvin_files/template/src\
> -Ifusion_sdk/calvin_files/utils/src\
> -Ifusion_sdk/calvin_files/writers/src\
> -Ifusion_sdk/file\
> -Ifusion_sdk/portability\
> -D_USE_MEM_MAPPING_
>
> PKG_SOURCES = \
> fusion_sdk/calvin_files/data/src/CDFData.cpp\
> fusion_sdk/calvin_files/data/src/CDFProbeGroupInformation.cpp\
> fusion_sdk/calvin_files/data/src/CDFProbeInformation.cpp\
> fusion_sdk/calvin_files/data/src/CDFProbeSetInformation.cpp\
> fusion_sdk/calvin_files/data/src/CDFQCProbeInformation.cpp\
> fusion_sdk/calvin_files/data/src/CDFQCProbeSetInformation.cpp\
> fusion_sdk/calvin_files/data/src/CELData.cpp\
> fusion_sdk/calvin_files/data/src/DataGroup.cpp\
> fusion_sdk/calvin_files/data/src/DataGroupHeader.cpp\
> fusion_sdk/calvin_files/data/src/DataSet.cpp\
> fusion_sdk/calvin_files/data/src/DataSetHeader.cpp\
> fusion_sdk/calvin_files/data/src/FileHeader.cpp\
> fusion_sdk/calvin_files/data/src/GenericData.cpp\
> fusion_sdk/calvin_files/data/src/GenericDataHeader.cpp\
> fusion_sdk/calvin_files/exception/src/ExceptionBase.cpp\
> fusion_sdk/calvin_files/fusion/src/CalvinAdapter/
> CalvinCELDataAdapter.cpp\
> fusion_sdk/calvin_files/fusion/src/FusionBPMAPData.cpp\
> fusion_sdk/calvin_files/fusion/src/FusionCDFData.cpp\
> fusion_sdk/calvin_files/fusion/src/FusionCDFQCProbeSetNames.cpp\
> fusion_sdk/calvin_files/fusion/src/FusionCELData.cpp\
> fusion_sdk/calvin_files/fusion/src/GCOSAdapter/GCOSCELDataAdapter.cpp\
> fusion_sdk/calvin_files/parameter/src/ParameterNameValueType.cpp\
> fusion_sdk/calvin_files/parsers/src/CDFFileReader.cpp\
> fusion_sdk/calvin_files/parsers/src/CelFileReader.cpp\
> fusion_sdk/calvin_files/parsers/src/DataGroupHeaderReader.cpp\
> fusion_sdk/calvin_files/parsers/src/DataGroupReader.cpp\
> fusion_sdk/calvin_files/parsers/src/DataSetHeaderReader.cpp\
> fusion_sdk/calvin_files/parsers/src/DataSetReader.cpp\
> fusion_sdk/calvin_files/parsers/src/FileHeaderReader.cpp\
> fusion_sdk/calvin_files/parsers/src/FileInput.cpp\
> fusion_sdk/calvin_files/parsers/src/GenericDataHeaderReader.cpp\
> fusion_sdk/calvin_files/parsers/src/GenericFileReader.cpp\
> fusion_sdk/calvin_files/utils/src/AffymetrixGuid.cpp\
> fusion_sdk/calvin_files/utils/src/DateTime.cpp\
> fusion_sdk/calvin_files/utils/src/FileUtils.cpp\
> fusion_sdk/calvin_files/utils/src/StringUtils.cpp\
> fusion_sdk/calvin_files/utils/src/checksum.cpp\
> fusion_sdk/file/BPMAPFileData.cpp\
> fusion_sdk/file/BPMAPFileWriter.cpp\
> fusion_sdk/file/CDFFileData.cpp\
> fusion_sdk/file/CELFileData.cpp\
> fusion_sdk/file/FileIO.cpp\
> fusion_sdk/file/FileWriter.cpp\
> R_affx_cel_parser.cpp\
> R_affx_cdf_parser.cpp\
> R_affx_cdf_extras.cpp\
> R_affx_bpmap_parser.cpp
>
> OBJS=$(PKG_SOURCES:.cpp=.o)
>
> all: $(SHLIB)
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595