File Coverage

Makefile.PL
Criterion Covered Total %
statement n/a
branch n/a
condition n/a
subroutine n/a
pod n/a
total n/a


line stmt bran cond sub pod time code
1             #
2             # Fake MakeMaker Makefile.PL - top level Makefile.PL for Redland
3             #
4             # $Id: Makefile.PL 11660 2006-11-30 07:28:57Z dajobe $
5             #
6             # Copyright (C) 2001-2006 David Beckett http://purl.org/net/dajobe/
7             # Copyright (C) 2001-2005 University of Bristol, UK http://www.bristol.ac.uk/
8             #
9             # This package is Free Software and part of Redland http://librdf.org/
10             #
11             # It is licensed under the following three licenses as alternatives:
12             # 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
13             # 2. GNU General Public License (GPL) V2 or any newer version
14             # 3. Apache License, V2.0 or any newer version
15             #
16             # You may not use this file except in compliance with at least one of
17             # the above three licenses.
18             #
19             # See LICENSE.html or LICENSE.txt at the top of this package for the
20             # complete terms and further detail along with the license texts for
21             # the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
22             #
23             #
24              
25             require 5.6.0;
26             use File::Basename;
27             use Config;
28              
29             my $program=basename $0;
30              
31             # Inspired by the way that ePerl does its configuration of perl.
32             # See http://www.engelschall.com/sw/eperl/
33             #
34             # There are many makefiles :) and this is their story
35             # Makefile.am Makefile.in - GNU automake, autoconf source files
36             # which generate Makefile after ./configure is run
37             # Makefile.PL - this file runs ./configure and renames
38             # the autoconfigure-made top level makefile Makefile to
39             # Makefile.stand and then uses it to do the top level build of
40             # Redland.
41             # Makefile.stand - autoconfigure-made makefile, renamed as described above
42             # Makefile - created by this script. A skeleton makefile that
43             # calls either the GNU autoconfigure-made top-level
44             # Makefile.stand or one of the makefiles in the perl directory.
45             # OR if this perl script isn't run, remains the top-level
46             # autoconfigure-made generated makefile built from
47             # Makefile.am/Makefile.in after substitution.
48             # perl/Makefile - autoconfigure made makefile for building the Redland
49             # perl interface inside Redland. Calls perl/Makefile.PL to create
50             # perl/Makefile.perl via the usual perl MakeMaker.
51             # perl/Makefile.perl - makefile built by perl/Makefile.PL using MakeMaker
52             # perl/Makefile.PL - MakeMaker source file for Redland perl interface
53             #
54             # All clear now?
55             #
56              
57             $TOP_SRCDIR=$ENV{TOP_SRCDIR} || '.';
58             $PACKAGE=$ENV{PACKAGE} || "Redland";
59              
60             my $version=$ENV{VERSION};
61              
62             if(!$version) {
63             my $conf_in_file="$TOP_SRCDIR/configure.ac";
64             open(CONF, $conf_in_file) or die "Cannot open $conf_in_file for version - $!\n";
65             while() {
66             if(/^AC_INIT\(\[[^]]+\],\s*([^,]+)/) {
67             $version=$1;
68             }
69             }
70             close(CONF);
71             die "Cannot find AC_INIT in $conf_in_file for version\n"
72             unless $version;
73             }
74              
75              
76             my $perl_makefile="Makefile";
77             my $standalone_makefile="Makefile.stand";
78              
79             unlink "$TOP_SRCDIR/$perl_makefile";
80             unlink "$TOP_SRCDIR/$standalone_makefile";
81              
82             my $perl = $Config{perlpath};
83              
84             my $prefix = $Config{prefix};
85              
86             my $cc = $Config{cc};
87             my $ccarg = "";
88             if ($args =~ m|CC=(\S+)|) {
89             $cc = $1;
90             $ccarg = "CC=$1 ";
91             }
92              
93             open(MK, ">$TOP_SRCDIR/$perl_makefile")
94             or die "Cannot create $TOP_SRCDIR/$perl_makefile - $!";
95              
96             print MK <<"EOM";
97             # Fake MakeMaker-compatible generated Makefile
98             # Generated automatically by $program
99             # DO NOT EDIT THIS FILE - changes will be lost
100             # To rebuild this makefile, run $perl $program with no arguments
101             #
102              
103             DISTNAME = $PACKAGE
104             VERSION = $version
105              
106             SHELL = /bin/sh
107             NOOP = \$(SHELL) -c true
108             RM_RF = rm -rf
109              
110             DISTVNAME = \$(DISTNAME)-\$(VERSION)
111             TAR = tar
112             TARFLAGS = cvf
113             ZIP = zip
114             ZIPFLAGS = -r
115             COMPRESS = gzip --best
116             SUFFIX = .gz
117             SHAR = shar
118             PREOP = @\$(NOOP)
119             POSTOP = @\$(NOOP)
120             TO_UNIX = @\$(NOOP)
121             CI = ci -u
122             DIST_CP = best
123             DIST_DEFAULT = tardist
124              
125              
126             # MakeMaker target
127             all: config
128              
129             # MakeMaker target
130             config: perl-config-stamp
131             perl-config-stamp:
132             \@if [ ! -f ${standalone_makefile} ]; then \\
133             cp ${perl_makefile} Makefile.perl; \\
134             echo "${ccarg}PERL=$perl ./configure --prefix=$prefix"; \\
135             ${ccarg}PERL=$perl ./configure --prefix=$prefix; \\
136             cp Makefile ${standalone_makefile}; \\
137             cp Makefile.perl ${perl_makefile}; \\
138             rm Makefile.perl; \\
139             echo \$(MAKE) -f ${standalone_makefile}; \\
140             \$(MAKE) -f ${standalone_makefile}; \\
141             fi
142             \@if [ ! -f perl/Makefile.perl ]; then \\
143             echo "cd perl"; \\
144             cd perl; \\
145             echo "\$(MAKE) \$(MFLAGS) Makefile.perl"; \\
146             \$(MAKE) \$(MFLAGS) Makefile.perl; \\
147             echo "\$(MAKE) \$(MFLAGS) -f Makefile.perl all"; \\
148             \$(MAKE) \$(MFLAGS) -f Makefile.perl all; \\
149             fi
150             touch perl-config-stamp
151              
152             # MakeMaker targets
153             check test: config
154             cd perl && \$(MAKE) \$(MFLAGS) \$@
155              
156             install: config
157             \@if [ -f ${standalone_makefile} ]; then \\
158             echo \$(MAKE) -k \$(MFLAGS) -f ${standalone_makefile} \$@; \\
159             (\$(MAKE) -k \$(MFLAGS) -f ${standalone_makefile} \$@; exit 0; ); \\
160             fi
161             cd perl && \$(MAKE) \$(MFLAGS) -f Makefile.perl \$@
162              
163             clean-core:
164             \@if [ -f ${standalone_makefile} ]; then \\
165             echo \$(MAKE) -k \$(MFLAGS) -f ${standalone_makefile} clean; \\
166             (\$(MAKE) -k \$(MFLAGS) -f ${standalone_makefile} clean; exit 0; ); \\
167             fi
168              
169             # MakeMaker target
170             clean: clean-core
171             \@if [ -f perl/Makefile.perl ]; then \\
172             echo "cd perl"; \\
173             cd perl; \\
174             echo "\$(MAKE) \$(MFLAGS) \$@\-perl"; \\
175             \$(MAKE) \$(MFLAGS) \$\@-perl; \\
176             fi
177             rm -f perl-config-stamp
178              
179             # MakeMaker/GNU target
180             distclean:
181             \$(MAKE) \$(MFLAGS) -f ${standalone_makefile} distclean
182             cd perl && \$(MAKE) \$(MFLAGS) realclean-perl
183             -rm -f ${standalone_makefile}
184             -rm -f ${perl_makefile}
185              
186             # Rebuild this generated makefile when the source file changes
187             Makefile: Makefile.PL
188             ${perl} Makefile.PL
189              
190             # MakeMaker[dist]/GNU targets
191             # Pass on some targets to GNU autoconfigured makefile in order
192             # so that 'make [all]' and 'make dist' work
193             all-recursive all-am clean-am distclean-am dist dist-hook: config
194             \$(MAKE) \$(MFLAGS) -f ${standalone_makefile} \$@
195              
196              
197             # MakeMaker targets
198             distcheck:
199             ${perl} -MExtUtils::Manifest=fullcheck -e fullcheck
200              
201             skipcheck:
202             ${perl} -MExtUtils::Manifest=skipcheck -e skipcheck
203              
204             .PHONY: MANIFEST
205              
206             manifest: MANIFEST
207              
208             MANIFEST: clean-core
209             $perl -MExtUtils::Manifest=mkmanifest -e mkmanifest
210              
211             # MakeMaker dist_dir section:
212             perl-distdir: MANIFEST
213             rm -rf \$(DISTVNAME)
214             $perl -MExtUtils::Manifest=manicopy,maniread \\
215             -e "manicopy(maniread(),'\$(DISTVNAME)', '\$(DIST_CP)');"
216              
217             tardist : \$(DISTVNAME).tar\$(SUFFIX)
218              
219             zipdist : \$(DISTVNAME).zip
220              
221             \$(DISTVNAME).tar\$(SUFFIX) : perl-distdir
222             \$(PREOP)
223             \$(TO_UNIX)
224             \$(TAR) \$(TARFLAGS) \$(DISTVNAME).tar \$(DISTVNAME)
225             \$(RM_RF) \$(DISTVNAME)
226             \$(COMPRESS) \$(DISTVNAME).tar
227             \$(POSTOP)
228              
229             \$(DISTVNAME).zip : perl-distdir
230             \$(PREOP)
231             \$(ZIP) \$(ZIPFLAGS) \$(DISTVNAME).zip \$(DISTVNAME)
232             \$(RM_RF) \$(DISTVNAME)
233             \$(POSTOP)
234              
235             EOM
236             close(MK)