aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-08 20:46:53 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-08 20:46:53 +0100
commitd6dd4da48e4c15623582fe0b561d8095498df4db (patch)
tree4708cfc32af2914cd49ecf36ac962b07ea46b694
parenta magical makefile, using a collection of submakefiles that are completely reusable without modifications (diff)
downloadscrotty-d6dd4da48e4c15623582fe0b561d8095498df4db.tar.gz
scrotty-d6dd4da48e4c15623582fe0b561d8095498df4db.tar.bz2
scrotty-d6dd4da48e4c15623582fe0b561d8095498df4db.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
-rw-r--r--Makefile3
-rw-r--r--mk/dist.mk6
-rw-r--r--mk/i18n.mk6
-rw-r--r--mk/lang-c.mk18
-rw-r--r--mk/man.mk9
-rw-r--r--mk/texinfo.mk6
6 files changed, 33 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index d249d99..3d6635e 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,9 @@ TEXINFO_FLAGS =
# List of translations.
LOCALES = sv
+# Ucomment to remove internationalisation support.
+#WITHOUT_GETTEXT = yes
+
# List of man page translations.
MAN_LOCALES = sv
diff --git a/mk/dist.mk b/mk/dist.mk
index 8b98cce..34b5f13 100644
--- a/mk/dist.mk
+++ b/mk/dist.mk
@@ -34,7 +34,8 @@ GPG_KEY ?=
# The packages and there detached signatures (if any.)
ifndef DO_NOT_SIGN
__DIST_FILES = $(foreach F,$(DIST_FORMATS),$(_PROJECT)-$(_VERSION).$(F) $(_PROJECT)-$(_VERSION).$(F).sig)
-else
+endif
+ifdef DO_NOT_SIGN
__DIST_FILES = $(foreach F,$(DIST_FORMATS),$(_PROJECT)-$(_VERSION).$(F))
endif
@@ -84,7 +85,8 @@ dist-bz2: $(_PROJECT)-$(_VERSION).tar.bz2 $(_PROJECT)-$(_VERSION).tar.bz2.sig
# Generate gzip-copressed tarball and signature of it.
.PHONY: dist-gz
dist-gz: $(_PROJECT)-$(_VERSION).tar.gz $(_PROJECT)-$(_VERSION).tar.sig
-else
+endif
+ifdef DO_NOT_SIGN
# Generate checksums, but no signature.
.PHONY: dist-checksums
dist-checksums: $(_PROJECT)-$(_VERSION).checksums
diff --git a/mk/i18n.mk b/mk/i18n.mk
index 526bc1f..842377b 100644
--- a/mk/i18n.mk
+++ b/mk/i18n.mk
@@ -39,7 +39,8 @@ uninstall: uninstall-locale
ifdef WITHOUT_GETTEXT
.PHONY: locale
locale:
-else
+endif
+ifndef WITHOUT_GETTEXT
.PHONY: locale
locale: $(foreach L,$(LOCALES),bin/mo/$(L)/messages.mo)
endif
@@ -84,7 +85,8 @@ bin/mo/%/messages.mo: po/%.po
ifdef WITHOUT_GETTEXT
.PHONY: install-locale
install-locale:
-else
+endif
+ifndef WITHOUT_GETTEXT
.PHONY: install-locale
install-locale: $(foreach L,$(LOCALES),bin/mo/$(L)/messages.mo)
@$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
diff --git a/mk/lang-c.mk b/mk/lang-c.mk
index a76a4c3..9d5dc8d 100644
--- a/mk/lang-c.mk
+++ b/mk/lang-c.mk
@@ -62,7 +62,8 @@ endif
# Optimisation settings for C code compilation.
ifdef DEBUG
OPTIMISE = -Og -g
-else
+endif
+ifndef DEBUG
ifndef OPTIMISE
OPTIMISE = -O2
endif
@@ -84,7 +85,8 @@ WARN = -Wall -Wextra $(_PEDANTIC) -Wdouble-promotion -Wformat=2 -Winit-self -Wmi
-Wsign-conversion -Wstrict-overflow=5 -Wconversion -Wsuggest-attribute=pure -Wswitch-default \
-Wstrict-aliasing=1 -fstrict-overflow -Wfloat-equal -Wpadded -Waggregate-return \
-Wtraditional-conversion
-else
+endif
+ifndef __USING_GCC
WARN = -Wall -Wextra $(_PEDANTIC)
endif
@@ -110,11 +112,13 @@ __H =
ifdef _HEADER_DIRLEVELS
ifeq ($(_HEADER_DIRLEVELS),1)
__H += src/*.h
-else
+endif
+ifneq ($(_HEADER_DIRLEVELS),1)
ifeq ($(_HEADER_DIRLEVELS),2)
__H += src/*.h
__H += src/*/*.h
-else
+endif
+ifneq ($(_HEADER_DIRLEVELS),2)
ifneq ($(_HEADER_DIRLEVELS),0)
__H += $(foreach W,$(shell $(SEQ) $(_HEADER_DIRLEVELS) | while read n; do $(ECHO) $$($(SEQ) $$n)" " | $(SED) 's/[^ ]* /\/\*/g'; done | $(XARGS) $(ECHO)),src$(W).h)
endif
@@ -156,7 +160,8 @@ install-cmd-c: $(foreach B,$(_BIN),bin/$(B))
$(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(BINDIR)"
ifdef COMMAND
$(Q)$(INSTALL_PROGRAM) $(__STRIP) $^ -- "$(DESTDIR)$(BINDIR)"
-else
+endif
+ifndef COMMAND
$(Q)$(INSTALL_PROGRAM) $(__STRIP) $^ -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
endif
@$(ECHO_EMPTY)
@@ -168,7 +173,8 @@ endif
uninstall-cmd-c:
ifdef COMMAND
-$(Q)$(RM) -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
-else
+endif
+ifndef COMMAND
-$(Q)$(RM) -- $(foreach B,$(_BIN),"$(DESTDIR)$(BINDIR)/$(B)")
endif
diff --git a/mk/man.mk b/mk/man.mk
index fa85de6..20beb50 100644
--- a/mk/man.mk
+++ b/mk/man.mk
@@ -74,7 +74,8 @@ install-man-untranslated:
$(Q)$(INSTALL_DIR) -- $(foreach S,$(_MAN_PAGE_SECTIONS),"$(DESTDIR)$(MANDIR)$(MAN$(S))")
ifndef __MAN_COMMAND
$(Q)$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),$(INSTALL_DATA) doc/man/$(P).$(S) -- "$(DESTDIR)$(MANDIR)$(MAN$(S))/$(P).$(MAN$(S)EXT)" &&)) $(TRUE)
-else
+endif
+ifdef __MAN_COMMAND
$(Q)$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),$(INSTALL_DATA) doc/man/$(P).$(S) -- "$(DESTDIR)$(MANDIR)$(MAN$(S))/$(__MAN_COMMAND)" &&)) $(TRUE)
endif
@$(ECHO_EMPTY)
@@ -85,7 +86,8 @@ install-man-locale:
$(Q)$(foreach L,$(MAN_LOCALES),$(INSTALL_DIR) -- $(foreach S,$(_MAN_PAGE_SECTIONS),"$(DESTDIR)$(MANDIR)/$(L)$(MAN$(S))") &&) $(TRUE)
ifndef __MAN_COMMAND
$(Q)$(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),$(INSTALL_DATA) doc/man/$(P).$(L).$(S) -- "$(DESTDIR)$(MANDIR)/$(L)$(MAN$(S))/$(P).$(MAN$(S)EXT)" &&))) $(TRUE)
-else
+endif
+ifdef __MAN_COMMAND
$(Q)$(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),$(INSTALL_DATA) doc/man/$(P).$(L).$(S) -- "$(DESTDIR)$(MANDIR)/$(L)$(MAN$(S))/$(__MAN_COMMAND)" &&))) $(TRUE)
endif
@$(ECHO_EMPTY)
@@ -99,7 +101,8 @@ uninstall-man:
ifndef __MAN_COMMAND
-$(Q)$(RM) -- $(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),"$(DESTDIR)$(MANDIR)$(MAN$(S))/$(P).$(MAN$(S)EXT)"))
-$(Q)$(RM) -- $(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),"$(DESTDIR)$(MANDIR)/$(L)$(MAN$(S))/$(P).$(MAN$(S)EXT)")))
-else
+endif
+ifdef __MAN_COMMAND
-$(Q)$(RM) -- "$(DESTDIR)$(MANDIR)$(MAN$(_MAN_PAGE_SECTIONS))/$(__MAN_COMMAND)"
-$(Q)$(RM) -- $(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),"$(DESTDIR)$(MANDIR)/$(L)$(MAN$(S))/$(__MAN_COMMAND)")))
endif
diff --git a/mk/texinfo.mk b/mk/texinfo.mk
index 163b6e6..db7fa07 100644
--- a/mk/texinfo.mk
+++ b/mk/texinfo.mk
@@ -65,11 +65,13 @@ __TEXI_SRC =
ifdef _TEXINFO_DIRLEVELS
ifeq ($(_TEXINFO_DIRLEVELS),1)
__TEXI_SRC += doc/info/*.texinfo
-else
+endif
+ifneq ($(_TEXINFO_DIRLEVELS),1)
ifeq ($(_TEXINFO_DIRLEVELS),2)
__TEXI_SRC += doc/info/*.texinfo
__TEXI_SRC += doc/info/*/*.texinfo
-else
+endif
+ifneq ($(_TEXINFO_DIRLEVELS),2)
__TEXI_SRC += $(foreach W,$(shell $(SEQ) $(_TEXINFO_DIRLEVELS) | while read n; do $(ECHO) $$($(SEQ) $$n)" " | $(SED) 's/[^ ]* /\/\*/g'; done | $(XARGS) $(ECHO)),doc/info$(W).texinfo)
endif
endif