Skip to content

Commit

Permalink
Merge pull request #169 from matsduf/fix-make-and-makefile
Browse files Browse the repository at this point in the history
Fix make and makefile
  • Loading branch information
matsduf authored Oct 26, 2020
2 parents c635860 + 4a61ab5 commit 1b2dfdd
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Makefile
/Makefile
Makefile.old
Build
Build.bat
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ docs/Installation.md
inc/Module/Install.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
inc/Module/Install/External.pm
inc/Module/Install/Fetch.pm
inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
Expand All @@ -18,6 +19,7 @@ META.yml
README.md
script/zonemaster-cli
script/zonemaster-info
share/GNUmakefile
share/Makefile
share/locale/da/LC_MESSAGES/Zonemaster-CLI.mo
share/locale/fr/LC_MESSAGES/Zonemaster-CLI.mo
Expand Down
23 changes: 19 additions & 4 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,28 @@ requires(
'Zonemaster::LDNS' => 2.0,
);

# Make all platforms include inc/Module/Install/External.pm
requires_external_bin 'find';
if ($^O eq "freebsd") {
requires_external_bin 'gmake';
};

sub MY::postamble {
return <<'MAKE_FRAG';
$(MYEXTLIB): share/Makefile
cd share && $(MAKE) all
MAKE_FRAG
my $sharemakefile = 'share/GNUmakefile';
if ($^O eq "freebsd") {
# Make FreeBSD use gmake for share
return "GMAKE ?= \"gmake\"\n"
. "pure_all :: $sharemakefile\n"
. "\tcd share && \$(GMAKE) all\n";
} else {
# Here Linux and GNU Make is assumed
return "pure_all :: $sharemakefile\n"
. "\tcd share && \$(MAKE) all\n";
};
};



install_script 'zonemaster-cli';
install_share;

Expand Down
2 changes: 1 addition & 1 deletion docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ This instruction covers the following operating systems:
2) Install dependencies available from binary packages:

```sh
pkg install p5-JSON-XS p5-Locale-libintl p5-MooseX-Getopt p5-Text-Reflow
pkg install devel/gmake p5-JSON-XS p5-Locale-libintl p5-MooseX-Getopt p5-Text-Reflow
```

3) Install Zonemaster::CLI:
Expand Down
39 changes: 39 additions & 0 deletions share/GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This is the main Makefile in this directory and should be kept
# GNU Make compatible.

.POSIX:
.SUFFIXES: .po .mo
.PHONY: all dist touch-po update-po extract-pot

DISTNAME = Zonemaster-CLI
POFILES := $(shell find . -maxdepth 1 -type f -name '*.po' -exec basename {} \;)
MOFILES := $(POFILES:%.po=%.mo)
POTFILE = $(DISTNAME).pot
PMFILES := $(shell find ../lib -type f -name '*.pm' | sort)

all: $(MOFILES)
@echo
@echo Remember to make sure all of the above names are in the
@echo MANIFEST file, or they will not be installed.
@echo

touch-po:
@touch $(POTFILE) $(POFILES)

update-po: extract-pot $(POFILES)

extract-pot:
@xgettext --output $(POTFILE) --sort-by-file --add-comments --language=Perl --from-code=UTF-8 -k__ -k\$$__ -k%__ -k__x -k__n:1,2 -k__nx:1,2 -k__xn:1,2 -kN__ -kN__n:1,2 -k__p:1c,2 -k__np:1c,2,3 -kN__p:1c,2 -kN__np:1c,2,3 $(PMFILES)

$(POTFILE): extract-pot

%.po: $(POTFILE)
@msgmerge --update --backup=none --quiet --no-location $(MSGMERGE_OPTS) $@ $(POTFILE)

.po.mo:
@msgfmt -o $@ $<
@mkdir -p locale/`basename $@ .mo`/LC_MESSAGES
@ln -vf $@ locale/`basename $@ .mo`/LC_MESSAGES/$(DISTNAME).mo

show-fuzzy:
@for f in $(POFILES) ; do msgattrib --only-fuzzy $$f ; done
41 changes: 10 additions & 31 deletions share/Makefile
Original file line number Diff line number Diff line change
@@ -1,36 +1,15 @@
.POSIX:
.SUFFIXES: .po .mo
.PHONY: all dist touch-po update-po extract-pot
# This is a wrapper for BSD Make (FreeBSD) to execute
# GNU Make (gmake) and the primary makefile GNUmakefile.

DISTNAME = Zonemaster-CLI
POFILES != find . -maxdepth 1 -type f -name '*.po'
MOFILES := $(POFILES:%.po=%.mo)
POTFILE = $(DISTNAME).pot
PMFILES != find ../lib -type f -name '*.pm' | sort
GNUMAKE?= gmake
FILES != ls *

all: $(MOFILES)
@echo
@echo Remember to make sure all of the above names are in the
@echo MANIFEST file, or they will not be installed.
@echo
# File targets should be evaluated by gmake.
.PHONY: all $(FILES)

touch-po:
@touch $(POTFILE) $(POFILES)
all:
@${GNUMAKE} $@

update-po: extract-pot $(POFILES)
.DEFAULT:
@${GNUMAKE} $@

extract-pot:
@xgettext --output $(POTFILE) --sort-by-file --add-comments --language=Perl --from-code=UTF-8 -k__ -k\$$__ -k%__ -k__x -k__n:1,2 -k__nx:1,2 -k__xn:1,2 -kN__ -kN__n:1,2 -k__p:1c,2 -k__np:1c,2,3 -kN__p:1c,2 -kN__np:1c,2,3 $(PMFILES)

$(POTFILE): extract-pot

%.po: $(POTFILE)
@msgmerge --update --backup=none --quiet --no-location $(MSGMERGE_OPTS) $@ $(POTFILE)

.po.mo:
@msgfmt -o $@ $<
@mkdir -p locale/`basename $@ .mo`/LC_MESSAGES
@ln -vf $@ locale/`basename $@ .mo`/LC_MESSAGES/$(DISTNAME).mo

show-fuzzy:
@for f in $(POFILES) ; do msgattrib --only-fuzzy $$f ; done

0 comments on commit 1b2dfdd

Please sign in to comment.