cgal/Maintenance/release_building/create_src_makefiles

137 lines
4.2 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';
# 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';
# 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