ExtUtils :: MakeMaker如何执行外部Makefile

时间:2018-09-23 18:12:47

标签: perl makefile

我对ExtUtils :: MakeMaker很陌生,我不知道如何处理用例。

我想利用ExtUtils :: MakeMaker来部署我的软件库。现在,我的Makefile.PL如下:

use ExtUtils::MakeMaker;

WriteMakefile(
    ABSTRACT         => 'i-MSCP Backend',
    AUTHOR           => 'Laurent Declercq <l.declercq@nuxwin.com>',
    NAME             => 'iMSCP',
    DISTNAME         => "iMSCP",
    LICENSE          => 'lgpl_2_1',
    MIN_PERL_VERSION => "5.0018_002",
    NAME             => 'iMSCP',
    VERSION_FROM     => 'lib/iMSCP/Version.pm',
    EXE_FILES        => [ qw$
        bin/imscp-courier-dovecot-migrate.pl
        bin/imscp-accounts-suspension
        bin/imscp-arpl-msgr
        bin/imscp-backup-clients
        bin/imscp-backup-imscp
        bin/imscp-dpkg-post-invoke
        bin/imscp-dsk-quota
        bin/imscp-fix-duplicate-mounts
        bin/imscp-installer
        bin/imscp-master-sql-user-info
        bin/imscp-mountall
        bin/imscp-net-traffic-logger
        bin/imscp-pkt-mngr
        bin/imscp-rkhunter
        bin/imscp-rqst-mngr
        bin/imscp-set-engine-permissions
        bin/imscp-set-gui-permissions
        bin/imscp-srv-traff
        bin/imscp-sw-mngr
        bin/imscp-uninstaller
        bin/imscp-update.php
        bin/imscp-vrl-traff
        bin/imscp-maillogconvert.pl
        bin/imscp-vlogger
    $ ],
    # Discard man pages
    MAN1PODS         => {},
    MAN3PODS         => {}
);

在我的lib目录中,我有一个外部Makefile,该文件负责构建Perl头文件:

#!/usr/bin/make -f

CC := gcc
CFLAGS := -DDEBUG=0 -s -ansi -Wall -Wextra -std=c11 -Wstrict-prototypes -pedantic-errors -O2

headers = sys/syscall.h linux/fs.h

# Debian/Ubuntu specific (Multiarch)
-include /usr/share/dpkg/architecture.mk
ifdef DEB_HOST_MULTIARCH
    headers += $(DEB_HOST_MULTIARCH)/sys/mount.h
    CFLAGS += -DMULTIARCH='"$(DEB_HOST_MULTIARCH)"'
else
    headers += sys/mount.h
endif

default: H2ph.pm
all: default

bin/%: %.c
    mkdir -p $(@D)
    $(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@

%.pm: bin/% h2ph
    $< > iMSCP/$@
    $(RM) -r bin/

h2ph:
    mkdir -p $@
    -cd /usr/include; h2ph -Q -a -d $(shell pwd)/$@ $(headers)

clean:
    $(RM) -r h2ph/ iMSCP/H2ph.pm

我想知道如何执行外部makefile。

0 个答案:

没有答案