⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mkmf

📁 这是国外的resip协议栈
💻
📖 第 1 页 / 共 2 页
字号:
#! /usr/bin/perl####################################################################### Copyright (C) 2001-2002 Peter J Jones (pjones@pmade.org)# All Rights Reserved# # Redistribution and use in source and binary forms, with or without# modification, are permitted provided that the following conditions# are met:# # 1. Redistributions of source code must retain the above copyright#    notice, this list of conditions and the following disclaimer.# 2. Redistributions in binary form must reproduce the above copyright#    notice, this list of conditions and the following disclaimer in#    the documentation and/or other materials provided with the#    distribution.# 3. Neither the name of the Author nor the names of its contributors#    may be used to endorse or promote products derived from this software#    without specific prior written permission.# # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A# PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF# SUCH DAMAGE.################################################################################## mkmf (Make a Makefile)# Peter J Jones (pjones@pmade.org)## This file is part of cxxtools (http://pmade.org/pjones/software/cxxtools/)################################################################################### Includes#################################################################################use strict;use File::Basename;use Getopt::Long;################################################################################## Constants#################################################################################use constant DATE		=> 'Tue May  8 22:21:39 2001';use constant ID			=> '$Id: mkmf,v 1.1 2003/08/12 06:28:53 jason Exp $';################################################################################## Global Variables#################################################################################my %clo;my $object_extension;my $static_lib_extension;my $shared_lib_extension;my $static_lib_prefix;my $shared_lib_prefix;my $exec_extension;my $depend_flag;my ($ar, $arflags, $arextra);my ($sar, $sarflags);my @objects;my $rmf = "rm -f";my $source_ext_re = qr{\.(cxx|cc|cpp|c|c\+\+)$};my $dirsep = '/';if ($^O =~ /mswin/i) {    $dirsep = '\\';}if ($^O =~ /mswin/i) {    $rmf = "del /F /Q";}################################################################################## Code Start#################################################################################GetOptions(    \%clo,    'help|h!',    'cxxflags=s',    'setid=s',    'developer!',    'include=s@',    'linkwith=s@',    'slinkwith=s@',    'many-exec!',    'one-exec=s',    'output|o=s',    'quiet!',    'static-lib=s',    'shared-lib=s',    'wrapper!',    'major=i',    'install=s',    'test-cmds=s',    'with-test:s',    'append=s@',    'clean-target=s@',    'clean-file=s@',    'fake-header=s@',    'mt!',) or usage();$clo{'help'} && usage();$clo{'linkwith'} ||= [];$clo{'include'} ||= [];$clo{'append'}	||= [];$clo{'clean-target'} ||= [];$clo{'clean-file'} ||= [];$clo{'fake-header'} ||= [];sub usage {    print "Usage: $0 <options> <source files>\n", <<EOT;  --help, -h             This message  --cxxflags path        Give path to the cxxflags script  --setid id             Use the given compiler id instead of checking  --developer            Add helpful stuff for a developer  --include path         Add include path to CXXFLAGS  --install spec         Add an install target using spec  --linkwith lib         Link executables with lib  --linkwith path,lib    Link executables with lib in path  --slinkwith lib        Static Link with lib  --slinkwith path,lib   Static Link with lib in path  --major num            Set major version for shared libraries  --mt                   Generate multithread safe code  --many-exec            Generate a Makefile for multiple executables  --one-exec basename    Generate a Makefile for one executable  --output, -o name      Name of file to generate [Default: Makefile]  --static-lib basename  Generate a Makefile for a static library  --shared-lib basename  Generate a Makefile for a shared library  --quiet                Be quiet  --wrapper              Generate a Makefile that calls other Makefile  --with-test            Generate a test target when using --wrapper                         you should give a comma seperated list of 			 directories to include in the wrap. Default to all.  --test-cmds            Add a test target that executes the given                         comma seperated list of commands  --append filename      Append the given file to the Makefile  --clean-target target  Add another target to the clean target  --clean-file filename  Remove the given file on a make clean  --fake-header filename Create a temp file for dependanciesYou must give a target type as well, target types are:  --one-exec  --many-exec  --static-lib  --shared-libYou can use --static-lib and --shared-lib at the same time.EOT    exit 1;}# set some defaults$clo{'output'}	    ||= 'Makefile';$clo{'cxxflags'}    ||= "..${dirsep}tools${dirsep}cxxflags";$clo{'cxxflags'}      = "'$clo{cxxflags}'";$clo{'major'}	    ||= '1';$ENV{'CXX'}	    ||= 'c++';$ENV{'CXXFLAGS'}    ||= '';$ENV{'LD'}	    ||= `$^X $clo{'cxxflags'} --linker`; chomp $ENV{'LD'};$ENV{'LDFLAGS'}	    ||= '';$ENV{'POST_LDFLAGS'}||= '';if ($clo{'setid'}) {    addflags($clo{'cxxflags'}, " --setid $clo{'setid'}");} else {    addflags($clo{'cxxflags'}, "--setid " . `$^X $clo{'cxxflags'} --getid`);}chomp($object_extension = `$^X $clo{'cxxflags'} --object-extension`);chomp($exec_extension = `$^X $clo{'cxxflags'} --exec-extension`);chomp($static_lib_extension = `$^X $clo{'cxxflags'} --static-lib-extension`);chomp($shared_lib_extension = `$^X $clo{'cxxflags'} --shared-lib-extension`);chomp($static_lib_prefix = `$^X $clo{'cxxflags'} --static-lib-prefix`);chomp($shared_lib_prefix = `$^X $clo{'cxxflags'} --shared-lib-prefix`);chomp($depend_flag = `$^X $clo{'cxxflags'} --depend`);chomp($ar = `$^X $clo{'cxxflags'} --ar`);chomp($arflags = `$^X $clo{'cxxflags'} --arflags`);chomp($arextra = `$^X $clo{'cxxflags'} --arextra`);chomp($sar = `$^X $clo{'cxxflags'} --sar`);chomp($sarflags = `$^X $clo{'cxxflags'} --sarflags`);clean($object_extension);clean($exec_extension);clean($static_lib_extension);clean($shared_lib_extension);clean($static_lib_prefix);clean($shared_lib_prefix);clean($depend_flag);clean($ar);clean($arflags);clean($arextra);clean($sar);clean($sarflags);if ($clo{'developer'}) {    addflags($ENV{'CXXFLAGS'}, `$^X $clo{'cxxflags'} --warn`);    addflags($ENV{'CXXFLAGS'}, `$^X $clo{'cxxflags'} --debug`);} else {    addflags($ENV{'CXXFLAGS'}, `$^X $clo{'cxxflags'} --optimize`);}if ($clo{'static-lib'} or $clo{'shared-lib'}) {    addflags($ENV{'CXXFLAGS'}, `$^X $clo{'cxxflags'} --pic`);}if ($clo{'mt'}) {    addflags($ENV{'CXXFLAGS'}, `$^X $clo{'cxxflags'} --mtcompile`);    addflags($ENV{'LDFLAGS'}, `$^X $clo{'cxxflags'} --mtlink`);}addflags($ENV{'CXXFLAGS'}, `$^X $clo{'cxxflags'} --general`);foreach (@{$clo{'slinkwith'}}) {    my ($lib, $path);    if (/,/) {	($path, $lib) = split(/,/, $_, 2);	$path .= $dirsep unless $path =~ /$dirsep$/;    } else {	$path = ".$dirsep";	$lib = $_;    }    $lib = $static_lib_prefix . $lib . $static_lib_extension;    addflags($ENV{'LDFLAGS'}, "'$path$lib'");}foreach (@{$clo{'linkwith'}}) {    addflags($ENV{'LDFLAGS'}, `$^X $clo{'cxxflags'} --linkwith "$_"`);}foreach (@{$clo{'include'}}) {    addflags($ENV{'CXXFLAGS'}, "-I$_");}if (!$clo{'static-lib'} && !$clo{'shared-lib'} && !$clo{'many-exec'} && !$clo{'one-exec'} && !$clo{'wrapper'}) {    print STDERR "$0: missing target type type\n";    usage();}if (!$clo{'wrapper'}) {    my $x;    @objects = map{	($x=$_) =~ s/$source_ext_re/$object_extension/i; clean($x); $x    } @ARGV;}open(MF, ">$clo{'output'}") || die "$0: can't create $clo{'output'}: $!";print MF "# This Makefile automaticly generated by $0\n";print MF "# File created on: ", scalar localtime, "\n";print MF "# DO NOT EDIT THIS FILE!\n\n";if (!$clo{'wrapper'}) {    print MF "CXX=$ENV{CXX}\n";    print MF "CXXFLAGS=$ENV{CXXFLAGS}\n";    print MF "AR=$ar\n";    print MF "ARFLAGS=$arflags\n";    print MF "SAR=$sar\n";    print MF "SARFLAGS=$sarflags\n";    print MF "LD=$ENV{LD}\n";    print MF "LDFLAGS=$ENV{LDFLAGS}\n";    print MF "POST_LDFLAGS=$ENV{POST_LDFLAGS}\n";    print MF "OBJECTS=", join(' ', @objects), "\n";}if (!$clo{'quiet'}) {    print '+', '-' x 70, "\n";    print "|    -*- Compiler Settings -*-\n";    print "|\n";    print "|      CXX = $ENV{CXX}\n";    print "| CXXFLAGS = $ENV{CXXFLAGS}\n";    print "|       AR = $ar\n";    print "|  ARFLAGS = $arflags\n";    print "|      SAR = $sar\n";    print "| SARFLAGS = $sarflags\n";    print "|       LD = $ENV{LD}\n";    print "|  LDFLAGS = $ENV{LDFLAGS}\n";    print '+', '-' x 70, "\n";}if ($clo{'one-exec'}) {    my $target = $clo{'one-exec'} . $exec_extension;    my $mkexec; chomp($mkexec = `$^X $clo{'cxxflags'} --mkexec $target`);    print MF "TARGETS=$target\n";    print MF "\n";    print MF "all: \$(TARGETS)\n";    print MF "\n";    print MF "$target: \$(OBJECTS)\n";    print MF "\t\$(LD) $mkexec \$(OBJECTS) \$(LDFLAGS) \$(POST_LDFLAGS)\n";} elsif ($clo{'many-exec'}) {    my $x;    my @targets = map{	($x=$_) =~ s/$source_ext_re/$exec_extension/i; clean($x); $x    } @ARGV;    print MF "TARGETS=", join(' ', @targets), "\n";    print MF "\n";    print MF "all: \$(TARGETS)\n";    print MF "\n";    foreach my $src (@ARGV) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -