cgal/Maintenance/release_building/create_src_makefiles

181 lines
6.1 KiB
Perl
Executable File

#!/sw/bin/perl
@source_files = glob("*.C");
@object_files = map {substr($_, 0,-2) . '$(OBJ_EXT)'} @source_files;
$, = " \\\n";
open MFLIB, ">makefile_lib";
print MFLIB <<'EOF';
# Copyright (c) 1999,2001,2006 Utrecht University (The Netherlands),
# ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
# INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
# (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
# and Tel-Aviv University (Israel). All rights reserved.
#
# This file is part of CGAL (www.cgal.org); you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; version 2.1 of the License.
# See the file LICENSE.LGPL distributed with CGAL.
#
# Licensees holding a valid commercial license may use this file in
# accordance with the commercial license agreement provided with the software.
#
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# $URL$
# $Id$
#
# Author(s) : various
# This is the makefile for compiling the CGAL object library libCGAL.a.
#
# N.B. There are different makefiles for creating the object library
# and the shared object library, because the suffix rules (in particular:
# the compiler flags) for these libraries are different.
#---------------------------------------------------------------------#
# include platform specific settings
#---------------------------------------------------------------------#
# Choose the right include file from the <cgalroot>/make directory.
CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE
include $(CGAL_MAKEFILE)
#---------------------------------------------------------------------#
# compiler flags
#---------------------------------------------------------------------#
CXXFLAGS = $(CGAL_LIB_CXXFLAGS)
#---------------------------------------------------------------------#
# Object files
#---------------------------------------------------------------------#
CGAL_OBJECTS = \
EOF
print MFLIB @object_files;
print MFLIB "\n";
print MFLIB <<'EOF';
#---------------------------------------------------------------------#
# target entries
#---------------------------------------------------------------------#
lib: lib_no_install
mv $(CGAL_LIB) $(CGAL_LIB_DESTINATION)
lib_no_install: $(CGAL_OBJECTS) $(CGAL_EXTRA_OBJECTS)
$(CGAL_LIB_CREATE)$(CGAL_LIB) \
`ls *$(OBJ_EXT) | awk '{for (i=1; i<=NF;++i){printf "$(CGAL_OBJ_PREFIX)";print $$i}}'`\
$(CGAL_LIB_LDFLAGS)
rm $(CGAL_OBJECTS) $(CGAL_EXTRA_OBJECTS)
workaround_4_irix.o:
$(CGAL_CC) $(CXXFLAGS) -c Interval_arithmetic/workaround_4_irix.s
workaround_4_irix6.o:
$(CGAL_CC) $(CXXFLAGS) -c Interval_arithmetic/workaround_4_irix6.s
clean:
rm -f $(CGAL_LIB) $(CGAL_OBJECTS) $(CGAL_EXTRA_OBJECTS)
#---------------------------------------------------------------------#
# suffix rules
#---------------------------------------------------------------------#
.C$(OBJ_EXT):
$(CGAL_CXX) $(CXXFLAGS) -c $<
EOF
close MFLIB;
open MFSHARED, ">makefile_sharedlib";
print MFSHARED <<'EOF';
# Copyright (c) 1999,2001,2006 Utrecht University (The Netherlands),
# ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
# INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
# (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
# and Tel-Aviv University (Israel). All rights reserved.
#
# This file is part of CGAL (www.cgal.org); you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; version 2.1 of the License.
# See the file LICENSE.LGPL distributed with CGAL.
#
# Licensees holding a valid commercial license may use this file in
# accordance with the commercial license agreement provided with the software.
#
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# $URL$
# $Id$
#
# Author(s) : various
# This is the makefile for compiling the CGAL shared object library libCGAL.so.
#
# N.B. There are different makefiles for creating the object library
# and the shared object library, because the suffix rules (in particular:
# the compiler flags) for these libraries are different.
#---------------------------------------------------------------------#
# include platform specific settings
#---------------------------------------------------------------------#
# Choose the right include file from the <cgalroot>/make directory.
CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE
include $(CGAL_MAKEFILE)
#---------------------------------------------------------------------#
# compiler flags
#---------------------------------------------------------------------#
CXXFLAGS = $(CGAL_SHARED_LIB_CXXFLAGS)
#---------------------------------------------------------------------#
# object files
#---------------------------------------------------------------------#
CGAL_OBJECTS = \
EOF
print MFSHARED @object_files;
print MFSHARED "\n";
print MFSHARED <<'EOF';
#---------------------------------------------------------------------#
# target entries
#---------------------------------------------------------------------#
lib: $(CGAL_OBJECTS) $(CGAL_EXTRA_OBJECTS)
$(CGAL_SHARED_LIB_CREATE)$(CGAL_SHARED_LIB) \
`ls *$(OBJ_EXT) | awk '{for (i=1; i<=NF;++i){printf "$(CGAL_OBJ_PREFIX)";print $$i}}'`\
$(CGAL_SHARED_LIB_LDFLAGS)
mv $(CGAL_SHARED_LIB) '$(CGAL_LIB_DESTINATION)'
rm $(CGAL_OBJECTS) $(CGAL_EXTRA_OBJECTS)
workaround_4_irix.o:
$(CGAL_CC) $(CXXFLAGS) -c Interval_arithmetic/workaround_4_irix.s
workaround_4_irix6.o:
$(CGAL_CC) $(CXXFLAGS) -c Interval_arithmetic/workaround_4_irix6.s
#---------------------------------------------------------------------#
# suffix rules
#---------------------------------------------------------------------#
.C$(OBJ_EXT):
$(CGAL_CXX) $(CXXFLAGS) -c $<
EOF