IPTables-IPv4-DBTarpit

 view release on metacpan or  search on metacpan

Tools/Makefile.PL  view on Meta::CPAN

use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.

################################################################
##    if built from a parent directory,                        #
##    at install, the parent Makefile must execute             #
##                                                             #
##          as step immediately after 'all'                    #
## @cd Tools && $(MAKE) relink4_$(LINKTYPE)_install $(PASTHRU) #
##                                                             #
################################################################

unless ((caller)[1]) {
  print "\n	WARNING... Please run from the parent directory\n\n";
}
$rebuild	= '.rebuild4test';

# generate a permanently OLD time for convenience
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
#                      YYCC MM  DD  HH  MM	current - 10 years
my $oldtime = sprintf("%04d%02d%02d%02d%02d ",$year+1890,$mon+1,$mday,$hour,$min);

my $relink_LD_RUN_PATH	= '/lib:/usr/local/lib';
my $relink_LIBS		= '-ldb -ldbtarpit';
my $relink_OBJECT	= 'Tools$(OBJ_EXT)';

WriteMakefile(
    'NAME'		=> 'IPTables::IPv4::DBTarpit::Tools',
    'VERSION_FROM'	=> 'Tools.pm', # finds $VERSION
    'LIBS'		=> ['-ldb '], # e.g., '-lm'
#    'LIBS'		=> ['-ldb -ldbtarpit'], # e.g., '-lm'
#    'INC'		=> "-I/usr/local/lib",
    'depend'		=> {'Tools.c'	=> 'bdbtarpit.o xs_include/miniSocket.inc',
			},
    'OBJECT'		=> "Tools.o bdbtarpit.o",
#    'OBJECT'		=> "Tools.o",
    'clean'		=> { FILES	=> "bdbtarpit.* *.bs *.o *~ $rebuild tmp*"},
);

sub MY::top_targets {
  package MY;
  my $inherited = shift->SUPER::top_targets(@_);
  $inherited =~ s/\n(pure_all\s+::.+)/\n$1 README/;
  $inherited .= q|
bdbtarpit.o	: bdbtarpit.c bdbtarpit.h
	$(CC) -c $(INC) $(CCFLAGS) $(OPTIMIZE) bdbtarpit.c

bdbtarpit.c	:
	@$(CP) ../bdbtarpit.c ./
	@$(NOOP)

bdbtarpit.h	:
	@$(CP) ../bdbtarpit.h ./
	@$(NOOP)
|;
}

sub inst_split {
  my $test = '# Linking for testing is done by default. The Tools module is
# linked directly to the object. At install time, the Tools module
# is re-linked to the shared library but will revert back to test mode 
# for other operations on the next make.

' . shift;
  my $type = shift;
  my $TYPE = '$(INST_'. uc $type . ')';
  $test =~ s#\n(\$\(INST.[^\s]+)\s*:(.+)#\n$1 : $rebuild $2#;	### dependency to rebuild if linked for install

  my $real = qq|
.PHONY: link4_${type}_install

relink4_${type}_install	:|. $';



( run in 0.808 second using v1.01-cache-2.11-cpan-6de40a662fe )