From aa8b08354c087d5baaf904fffeeb5b0d074adb9e Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 24 Jan 2012 20:23:12 -0500 Subject: Start trying to modularize the makefiles. --- diff --git a/Makefile.in b/Makefile.in index 3b4a5d8..af9b635 100644 --- a/Makefile.in +++ b/Makefile.in @@ -19,90 +19,54 @@ SHELL = @shell@ INSTALL = @install@ +MAKE = @make@ SRCDIR = @srcdir@ PREFIX = @prefix@ BINDIR = @bindir@ LIBDIR = @libdir@ MANDIR = @mandir@ +MAKE = @make@ .SUFFIXES: -OBJS = lib/controlfields src/opkbuild \ - src/oh-strip src/oh-installfiles src/oh-gencontrol src/oh-buildopk \ - .PHONY: all -all: $(OBJS) - -src lib: - @printf ' Making directories...\n' - @mkdir src lib +all: sedscript + @printf 'Making executable files...\n' + @$(MAKE) -f src/Makefile all + @printf 'Making library files...\n' + @$(MAKE) -f lib/Makefile all + @printf 'Making manual pages...\n' + @$(MAKE) -f man/Makefile all sedscript: - @printf ' Writing sed script...\n' + @printf 'Writing sed script...\n' @echo 's&@@BINDIR@@&$(BINDIR)&' > sedscript @echo 's&@@LIBDIR@@&$(LIBDIR)&' >> sedscript -$(OBJS): src lib sedscript - @printf ' SED $@\n' - @sed -f sedscript $(SRCDIR)/$@ > $@ - .PHONY: clean clean: - rm -Rf src lib sedscript + @printf 'Cleaning executable files...\n' + @$(MAKE) -f src/Makefile clean + @printf 'Cleaning library files...\n' + @$(MAKE) -f lib/Makefile clean + @printf 'Cleaning manual pages...\n' + @$(MAKE) -f man/Makefile clean .PHONY: install install: all - @printf ' INSTALL src/opkbuild\n' - @$(INSTALL) -D "src/opkbuild" "$(DESTDIR)/$(BINDIR)/opkbuild" - @printf ' INSTALL src/oh-strip\n' - @$(INSTALL) -D "src/oh-strip" "$(DESTDIR)/$(BINDIR)/oh-strip" - @printf ' INSTALL src/oh-installfiles\n' - @$(INSTALL) -D "src/oh-installfiles" "$(DESTDIR)/$(BINDIR)/oh-installfiles" - @printf ' INSTALL src/oh-gencontrol\n' - @$(INSTALL) -D "src/oh-gencontrol" "$(DESTDIR)/$(BINDIR)/oh-gencontrol" - @printf ' INSTALL src/oh-buildopk\n' - @$(INSTALL) -D "src/oh-buildopk" "$(DESTDIR)/$(BINDIR)/oh-buildopk" - @printf ' INSTALL lib/controlfields\n' - @$(INSTALL) -D "lib/controlfields" \ - "$(DESTDIR)/$(LIBDIR)/opkhelper/controlfields" - @printf ' INSTALL man/opkbuild.1\n' - @$(INSTALL) -D "$(SRCDIR)/man/opkbuild.1" \ - "$(DESTDIR)/$(MANDIR)/man1/opkbuild.1" - @printf ' INSTALL man/oh-strip.1\n' - @$(INSTALL) -D "$(SRCDIR)/man/oh-strip.1" \ - "$(DESTDIR)/$(MANDIR)/man1/oh-strip.1" - @printf ' INSTALL man/oh-installfiles.1\n' - @$(INSTALL) -D "$(SRCDIR)/man/oh-installfiles.1" \ - "$(DESTDIR)/$(MANDIR)/man1/oh-installfiles.1" - @printf ' INSTALL man/oh-gencontrol.1\n' - @$(INSTALL) -D "$(SRCDIR)/man/oh-gencontrol.1" \ - "$(DESTDIR)/$(MANDIR)/man1/oh-gencontrol.1" - @printf ' INSTALL man/oh-buildopk.1\n' - @$(INSTALL) -D "$(SRCDIR)/man/oh-buildopk.1" \ - "$(DESTDIR)/$(MANDIR)/man1/oh-buildopk.1" + @printf 'Installing executable files...\n' + @$(MAKE) -f src/Makefile install + @printf 'Installing libary files...\n' + @$(MAKE) -f lib/Makefile install + @printf 'Installing manual pages...\n' + @$(MAKE) -f man/Makefile install .PHONY: uninstall uninstall: - @printf ' RM opkbuild\n' - @rm -f "$(DESTDIR)/$(BINDIR)/opkbuild" - @printf ' RM oh-strip\n' - @rm -f "$(DESTDIR)/$(BINDIR)/oh-strip" - @printf ' RM oh-installfiles\n' - @rm -f "$(DESTDIR)/$(BINDIR)/oh-installfiles" - @printf ' RM oh-gencontrol\n' - @rm -f "$(DESTDIR)/$(BINDIR)/oh-gencontrol" - @printf ' RM oh-buildopk\n' - @rm -f "$(DESTDIR)/$(BINDIR)/oh-buildopk" - @printf ' RM controlfields\n' - @rm -f "$(DESTDIR)/$(LIBDIR)/opkhelper/controlfields" - @printf ' RM opkbuild.1\n' - @rm -f "$(DESTDIR)/$(MANDIR)/man1/opkbuild.1" - @printf ' RM oh-strip.1\n' - @rm -f "$(DESTDIR)/$(MANDIR)/man1/oh-strip.1" - @printf ' RM oh-installfiles.1\n' - @rm -f "$(DESTDIR)/$(MANDIR)/man1/oh-installfiles.1" - @printf ' RM oh-gencontrol.1\n' - @rm -f "$(DESTDIR)/$(MANDIR)/man1/oh-gencontrol.1" - @printf ' RM oh-buildopk.1\n' - @rm -f "$(DESTDIR)/$(MANDIR)/man1/oh-buildopk.1" + @printf 'Uninstalling executable files...\n' + @$(MAKE) -f src/Makefile uninstall + @printf 'Uninstalling library files...\n' + @$(MAKE) -f lib/Makefile uninstall + @printf 'Uninstalling manual pages...\n' + @$(MAKE) -f man/Makefile uninstall diff --git a/Makefile.in.mod b/Makefile.in.mod new file mode 100644 index 0000000..022ddcb --- /dev/null +++ b/Makefile.in.mod @@ -0,0 +1,116 @@ +# opkhelper +# Makefile.in +# Input Makefile for configure. +# +# Copyright (C) 2012 Patrick "P. J." McDermott +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +SHELL = @shell@ +INSTALL = @install@ + +SRCDIR = @srcdir@ +PREFIX = @prefix@ +BINDIR = @bindir@ +LIBDIR = @libdir@ +MANDIR = @mandir@ + +.SUFFIXES: + +OBJS = lib/controlfields src/opkbuild \ + src/oh-strip src/oh-installfiles src/oh-gencontrol src/oh-buildopk \ + +.PHONY: all +all: $(OBJS) + +src lib: + @printf 'Making directories\n' + @mkdir src lib + +sedscript: + @printf 'Writing sed script\n' + @echo 's&@@BINDIR@@&$(BINDIR)&' > sedscript + @echo 's&@@LIBDIR@@&$(LIBDIR)&' >> sedscript + +$(OBJS): src lib sedscript + @printf ' SED $@\n' + @sed -f sedscript $(SRCDIR)/$@ > $@ + +.PHONY: clean +clean: + rm -Rf src lib sedscript + +.PHONY: install +install: install-bin install-doc + +.PHONY: install-bin +install-bin: + @printf 'Installing executable files\n' + @printf ' INSTALL src/opkbuild\n' + @$(INSTALL) -D "src/opkbuild" "$(DESTDIR)/$(BINDIR)/opkbuild" + @printf ' INSTALL src/oh-strip\n' + @$(INSTALL) -D "src/oh-strip" "$(DESTDIR)/$(BINDIR)/oh-strip" + @printf ' INSTALL src/oh-installfiles\n' + @$(INSTALL) -D "src/oh-installfiles" "$(DESTDIR)/$(BINDIR)/oh-installfiles" + @printf ' INSTALL src/oh-gencontrol\n' + @$(INSTALL) -D "src/oh-gencontrol" "$(DESTDIR)/$(BINDIR)/oh-gencontrol" + @printf ' INSTALL src/oh-buildopk\n' + @$(INSTALL) -D "src/oh-buildopk" "$(DESTDIR)/$(BINDIR)/oh-buildopk" + @printf ' INSTALL lib/controlfields\n' + @$(INSTALL) -D "lib/controlfields" \ + "$(DESTDIR)/$(LIBDIR)/opkhelper/controlfields" + +.PHONY: install-doc +install-doc: + @printf 'Installing documentation files\n' + @printf ' INSTALL man/opkbuild.1\n' + @$(INSTALL) -D "$(SRCDIR)/man/opkbuild.1" \ + "$(DESTDIR)/$(MANDIR)/man1/opkbuild.1" + @printf ' INSTALL man/oh-strip.1\n' + @$(INSTALL) -D "$(SRCDIR)/man/oh-strip.1" \ + "$(DESTDIR)/$(MANDIR)/man1/oh-strip.1" + @printf ' INSTALL man/oh-installfiles.1\n' + @$(INSTALL) -D "$(SRCDIR)/man/oh-installfiles.1" \ + "$(DESTDIR)/$(MANDIR)/man1/oh-installfiles.1" + @printf ' INSTALL man/oh-gencontrol.1\n' + @$(INSTALL) -D "$(SRCDIR)/man/oh-gencontrol.1" \ + "$(DESTDIR)/$(MANDIR)/man1/oh-gencontrol.1" + @printf ' INSTALL man/oh-buildopk.1\n' + @$(INSTALL) -D "$(SRCDIR)/man/oh-buildopk.1" \ + "$(DESTDIR)/$(MANDIR)/man1/oh-buildopk.1" + +.PHONY: uninstall +uninstall: + @printf ' RM opkbuild\n' + @rm -f "$(DESTDIR)/$(BINDIR)/opkbuild" + @printf ' RM oh-strip\n' + @rm -f "$(DESTDIR)/$(BINDIR)/oh-strip" + @printf ' RM oh-installfiles\n' + @rm -f "$(DESTDIR)/$(BINDIR)/oh-installfiles" + @printf ' RM oh-gencontrol\n' + @rm -f "$(DESTDIR)/$(BINDIR)/oh-gencontrol" + @printf ' RM oh-buildopk\n' + @rm -f "$(DESTDIR)/$(BINDIR)/oh-buildopk" + @printf ' RM controlfields\n' + @rm -f "$(DESTDIR)/$(LIBDIR)/opkhelper/controlfields" + @printf ' RM opkbuild.1\n' + @rm -f "$(DESTDIR)/$(MANDIR)/man1/opkbuild.1" + @printf ' RM oh-strip.1\n' + @rm -f "$(DESTDIR)/$(MANDIR)/man1/oh-strip.1" + @printf ' RM oh-installfiles.1\n' + @rm -f "$(DESTDIR)/$(MANDIR)/man1/oh-installfiles.1" + @printf ' RM oh-gencontrol.1\n' + @rm -f "$(DESTDIR)/$(MANDIR)/man1/oh-gencontrol.1" + @printf ' RM oh-buildopk.1\n' + @rm -f "$(DESTDIR)/$(MANDIR)/man1/oh-buildopk.1" diff --git a/configure b/configure index 69af311..17f2949 100755 --- a/configure +++ b/configure @@ -171,6 +171,7 @@ missing_dependencies=false find_dependency sh SHELL /bin find_dependency install INSTALL /usr/bin +find_dependency make MAKE /usr/bin if ${missing_dependencies}; then printf '\nSome dependencies could not be found.\n' @@ -181,6 +182,7 @@ fi sed_script=" s&@shell@&${SHELL}& s&@install@&${INSTALL} -c& +s&@make@&${MAKE}& s&@srcdir@&${SRCDIR}& s&@prefix@&${PREFIX}& s&@bindir@&${BINDIR}& @@ -188,6 +190,10 @@ s&@libdir@&${LIBDIR}& s&@mandir@&${MANDIR}&" # Replace configuration variables in Makefile.in +mkdir src lib man sed "$sed_script" ${SRCDIR}/Makefile.in > Makefile +sed "$sed_script" ${SRCDIR}/src/Makefile.in > src/Makefile +sed "$sed_script" ${SRCDIR}/lib/Makefile.in > lib/Makefile +sed "$sed_script" ${SRCDIR}/man/Makefile.in > man/Makefile printf '\nConfiguration complete!\n\n' diff --git a/lib/Makefile.in b/lib/Makefile.in new file mode 100644 index 0000000..a29e71b --- /dev/null +++ b/lib/Makefile.in @@ -0,0 +1,58 @@ +# opkhelper +# Makefile.in +# Input Makefile for configure. +# +# Copyright (C) 2012 Patrick "P. J." McDermott +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +SHELL = @shell@ +INSTALL = @install@ +MAKE = @make@ + +SRCDIR = @srcdir@ +PREFIX = @prefix@ +LIBDIR = @libdir@ + +.SUFFIXES: + +OBJS = controlfields + +.PHONY: all +all: $(OBJS) + +$(OBJS): + @printf ' SED %s\n' '$@' + @sed -f sedscript $(SRCDIR)/lib/$@ > lib/$@ + +.PHONY: clean +clean: + @ for obj in $(OBJS); do \ + printf ' RM lib/%s\n' "\${obj}"; \ + rm -f lib/\${obj}; \ + done + +.PHONY: install +install: all + @ for obj in $(OBJS); do \ + printf ' INSTALL lib/%s\n' "\${obj}"; \ + $(INSTALL) -D lib/\${obj} "$(DESTDIR)/$(LIBDIR)"; \ + done + +.PHONY: uninstall +uninstall: + @ for obj in $(OBJ); do \ + printf ' RM %s\n' "\${obj}"; \ + rm -f "$(DESTDIR)/$(LIBDIR)/\${obj}"; \ + done diff --git a/man/Makefile.in b/man/Makefile.in new file mode 100644 index 0000000..45059ca --- /dev/null +++ b/man/Makefile.in @@ -0,0 +1,58 @@ +# opkhelper +# Makefile.in +# Input Makefile for configure. +# +# Copyright (C) 2012 Patrick "P. J." McDermott +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +SHELL = @shell@ +INSTALL = @install@ +MAKE = @make@ + +SRCDIR = @srcdir@ +PREFIX = @prefix@ +MANDIR = @mandir@ + +.SUFFIXES: + +OBJS = opkbuild.1 oh-strip.1 oh-installfiles.1 oh-gencontrol.1 oh-buildopk.1 + +.PHONY: all +all: $(OBJS) + +$(OBJS): + @printf ' CP man/%s\n' '$@' + @cp $(SRCDIR)/man/$@ man/$@ + +.PHONY: clean +clean: + @ for obj in $(OBJS); do \ + printf ' RM man/%s\n' "\${obj}"; \ + rm -f man/\${obj}; \ + done + +.PHONY: install +install: all + @ for obj in $(OBJS); do \ + printf ' INSTALL man/%s\n' "\${obj}"; \ + $(INSTALL) -D man/\${obj} "$(DESTDIR)/$(MANDIR)"; \ + done + +.PHONY: uninstall +uninstall: + @ for obj in $(OBJ); do \ + printf ' RM %s\n' "\${obj}"; \ + rm -f "$(DESTDIR)/$(MANDIR)/\${obj}"; \ + done diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..2931f11 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,58 @@ +# opkhelper +# Makefile.in +# Input Makefile for configure. +# +# Copyright (C) 2012 Patrick "P. J." McDermott +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +SHELL = @shell@ +INSTALL = @install@ +MAKE = @make@ + +SRCDIR = @srcdir@ +PREFIX = @prefix@ +BINDIR = @bindir@ + +.SUFFIXES: + +OBJS = opkbuild oh-strip oh-installfiles oh-gencontrol oh-buildopk + +.PHONY: all +all: $(OBJS) + +$(OBJS): + @printf ' SED %s\n' '$@' + @sed -f sedscript $(SRCDIR)/src/$@ > src/$@ + +.PHONY: clean +clean: + @ for obj in $(OBJS); do \ + printf ' RM src/%s\n' "\${obj}"; \ + rm -f src/\${obj}; \ + done + +.PHONY: install +install: all + @ for obj in $(OBJS); do \ + printf ' INSTALL src/%s\n' "\${obj}"; \ + $(INSTALL) -D src/\${obj} "$(DESTDIR)/$(BINDIR)"; \ + done + +.PHONY: uninstall +uninstall: + @ for obj in $(OBJ); do \ + printf ' RM %s\n' "\${obj}"; \ + rm -f "$(DESTDIR)/$(BINDIR)/\${obj}"; \ + done -- cgit v0.9.1