freebsd-dev/gnu/usr.bin/perl/Makefile.inc
Ruslan Ermilov 4448c79e47 Fix cross-building, etc:
1.  To cross-build, one now needs to set TARGET_ARCH, and not the
    MACHINE_ARCH.  MACHINE_ARCH should never be changed manually!

2.  Initialize DESTDIR= explicitly for bootstrap-tools, build-tools,
    and cross-tools stages.  This fixes broken header and library
    dependencies problem.  We build them in the host environment,
    and obviously want them to depend on host headers and libraries.
    The problem with broken header dependencies for bootstrap-tools
    and cross-tools was already partially solved (see BOOTSTRAPPING
    tests in bsd.prog.mk and bsd.lib.mk), but it was still there for
    build-tools if the user ran "make world DESTDIR=/foo".  Also,
    for all of these stages, the library dependencies were broken
    because of how bsd.libnames.mk define DPADD members.

    We still provide a glue to install bootstrap- and cross-tools
    under the ${WORLDTMP}.

    Removed PATH overrides for bootstrap-, build-, and cross-tools
    stages.  There is just no reason why we would need to override
    it, and the hacks to clean up the ${WORLDTMP} in the -DNOCLEAN
    case are no longer needed with fixes from this step.

    That is, we now never use ${WORLDTMP} headers and libraries,
    and we don't use any ${WORLDTMP} installed binaries during
    these stages.  Again, these stages depend solely on the host
    environment, including compiler, headers, and libraries.

3.  Moved "miniperl" back from cross-tools (it has nothing to do
    with a cross-compiler) to build-tools where it belongs.  The
    change from step 1 let to do this.  Also, to make this work,
    build-tools targets of "cc_tools" and "miniperl" were modified
    to call "depend".  Here follow the detailed explanations.

    There are two categories of build tools, for now.  In the first
    category there are "cc_tools" and "miniperl".  They occupy the
    whole (sub)directory, and nothing needs to be done in this
    subdirectory later during the "all" stage.  They are also
    constructed using system makefiles.  We must build the .depend
    early in the build-tools stage because:

    1)  They use (and depend on) the host environment.

    2)  If we don't do this in build-tools, the "depend" stage of
        buildworld will do this for us; wrong library and header
        dependencies will be recorded (DESTDIR=${WORLDTMP}) and,
        what's worse, the "all" stage may then clobber the
        build-architecture format tools (that we built in the
        build-tools stage) with the target-architecture format
        ones, breaking cross build.

    In the second category there are all other build-tools.  They
    share their directory with the "main" module that needs them
    in the "all" stage, and they don't show up themselves in the
    .depend file.  The portion of this fix was already committed
    in gnu/usr.bin/cc/cc_tools/Makefile,v 1.52.

4.  "libperl" is no longer a build tool, and "miniperl" is the
    stand-alone application.  I had to make this change because
    build-tools and "all" stages share the same object directory.
    Without this change, if we cross compile, libperl.a is first
    built for the build architecture during the build-tools stage
    (for the purposes of immediate linkage with "miniperl").
    Later on, the "all" stage sees this library as up-to-date,
    and doesn't rebuild it.  The effect is that the wrong format
    static libperl library is installed with installworld.

5.  Fixed "includes" to install secure/lib/libtelnet headers if
    required.

Reviewed by:	bde
2001-09-29 13:17:54 +00:00

126 lines
3.5 KiB
Makefile

# $FreeBSD$
PERL5SRC?= ${.CURDIR}/../../../../contrib/perl5
PERL5LIBSRC?= ${.CURDIR}/../libperl
.if exists(${.OBJDIR}/../miniperl/miniperl)
MINIPERL?= ${.OBJDIR}/../miniperl/miniperl
.else
MINIPERL?= ${.OBJDIR}/../../miniperl/miniperl
.endif
BINDIR?= /usr/bin
SHLIB_MAJOR?= 4
VERSION= 5.6.0
DYNALOADER= lib/auto/DynaLoader/DynaLoader.a
HEADERS=EXTERN.h INTERN.h XSUB.h av.h cc_runtime.h cop.h cv.h dosish.h \
embed.h embedvar.h fakethr.h form.h gv.h handy.h hv.h intrpvar.h \
iperlsys.h keywords.h mg.h nostdio.h objXSUB.h op.h opcode.h \
opnames.h patchlevel.h perl.h perlapi.h perlio.h perlsdio.h \
perlsfio.h perlvars.h perly.h pp.h pp_proto.h proto.h regcomp.h \
regexp.h regnodes.h scope.h sv.h thrdvar.h thread.h unixish.h \
utf8.h util.h warnings.h
DEPEND_H=
.for I in ${HEADERS}
${.OBJDIR}/${I}: ${I}
@ln -sf ${.OODATE} ${.TARGET}
CLEANFILES+= ${.OBJDIR}/${I}
DEPEND_H+= ${.OBJDIR}/${I}
.endfor
LDFLAGS+= -L${.OBJDIR}/../libperl
links: ${DEPEND_H}
@for d in ${FARMDIRS} ; do \
rm -rf $${d} ;\
for i in `cd ${PERL5SRC}; find $${d} -type d -a \! -name CVS` ;\
do \
mkdir -p $${i} ;\
done ;\
for i in `cd ${PERL5SRC}; find $${d} -type f | grep -v CVS` ;\
do \
ln -s ${PERL5SRC}/$${i} $${i} ;\
done ;\
done
@ln -sf ${PERL5SRC}/ext/File/Glob/Glob.pm lib/File/Glob.pm
@-mkdir lib/auto
@-mkdir build
@ln -sf ${PERL5SRC}/config_h.SH config_h.sh
@ln -sf ${PERL5SRC}/cflags.SH cflags.sh
@ln -sf ${PERL5SRC}/ext/re/re.pm lib/re.pm
@ln -sf ${PERL5SRC}/myconfig.SH myconfig.SH
@ln -sf ${PERL5SRC}/miniperlmain.c miniperlmain.c
@ln -sf ${PERL5SRC}/writemain.SH writemain.sh
@ln -sf ${PERL5SRC}/regcomp.c regcomp.c
@ln -sf ${PERL5SRC}/regexec.c regexec.c
@ln -sf ${PERL5LIBSRC}/config.SH-${OBJFORMAT}.${MACHINE_ARCH} \
config.sh
@touch ${.TARGET}
scripts: links
@sh config_h.sh
@sh cflags.sh
@sh writemain.sh
@sh myconfig.SH
@${MINIPERL} ${PERL5SRC}/configpm \
Config.pm Porting/Glossary myconfig
@ln -sf ../Config.pm lib/Config.pm
@touch ${.TARGET}
.if !defined(NO_PERL_SCRIPT_MAKE)
config.h: scripts
.endif
CLEANFILES+= links scripts
CLEANFILES+= config.h config.sh config_h.sh Config.pm
CLEANFILES+= myconfig myconfig.SH
CLEANFILES+= regcomp.c regexec.c miniperlmain.c
CLEANFILES+= writemain writemain.sh cflags cflags.sh
CLEANDIRS+= lib ext Porting hints build
FARMDIRS= lib ext Porting hints
MAKEMAKER_ARGS?= INSTALLDIRS=perl PERL_SRC=${.OBJDIR} \
INSTALLMAN3DIR=${DESTDIR}/usr/share/perl/man3 \
PERL=${MINIPERL} FULLPERL=perl DEFINE=-I${DESTDIR}/usr/include \
DEFINE=-DPERL_CORE
CFLAGS+= '-DAPPLLIB_EXP="/usr/libdata/perl/BSDPAN"'
.if defined(PERL_DEBUGGING) && ${PERL_DEBUGGING} == "true"
CFLAGS+= -DDEBUGGING
.endif
autosplit: scripts lib/*.pm lib/*/*.pm
${MINIPERL} -I${.OBJDIR}/lib \
-e 'use AutoSplit; autosplit_lib_modules(@ARGV)' \
lib/*.pm lib/*/*.pm
@touch ${.TARGET}
${DYNALOADER}: scripts \
ext/DynaLoader/DynaLoader.pm ext/DynaLoader/XSLoader.pm \
ext/DynaLoader/Makefile
@cd ext/DynaLoader; \
make -B all PERL_SRC=${.OBJDIR}
ext/DynaLoader/DynaLoader.pm: scripts ext/DynaLoader/DynaLoader_pm.PL
@cd ext/DynaLoader; \
${MINIPERL} -I${.OBJDIR} -I${.OBJDIR}/lib DynaLoader_pm.PL DynaLoader.pm
ext/DynaLoader/XSLoader.pm: scripts ext/DynaLoader/XSLoader_pm.PL
@cd ext/DynaLoader; \
${MINIPERL} -I${.OBJDIR} -I${.OBJDIR}/lib XSLoader_pm.PL XSLoader.pm
ext/DynaLoader/Makefile: scripts ext/DynaLoader/Makefile.PL
@cd ext/DynaLoader; \
${MINIPERL} -I${.OBJDIR} -I${.OBJDIR}/lib Makefile.PL ${MAKEMAKER_ARGS} \
LINKTYPE=static LIBS="-lperl -lm"; \
make -B config PERL_SRC=${.OBJDIR}