From 2728d489673f1d97a43e4f8d888b3591c233cfb7 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 6 Sep 2016 14:42:55 -0400 Subject: (systemd) build-aux: gitfiles --- build-aux/Makefile.once.head/00-gitfiles.mk | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 build-aux/Makefile.once.head/00-gitfiles.mk (limited to 'build-aux/Makefile.once.head/00-gitfiles.mk') diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk new file mode 100644 index 0000000..95437aa --- /dev/null +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -0,0 +1,32 @@ +# Copyright (C) 2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +mod.gitfiles.description = Automatically populate files.src.src from git +mod.gitfiles.depends += files nested write-ifchanged quote + +gitfiles.file ?= Makefile-src.mk + +_gitfiles.all = +-include $(topsrcdir)/$(gitfiles.file) + +ifneq ($(wildcard $(topsrcdir)/.git),) +$(topsrcdir)/$(gitfiles.file): _gitfiles.FORCE + @(cd $(@D) && git ls-files -z) | sed -z -e 's/\$$/\$$$$/g' -e 's/\n/$$(at.nl)/g' | xargs -r0 printf '_gitfiles.all+=%s\n' | $(WRITE_IFCHANGED) $@ +.PHONY: _gitfiles.FORCE +endif + +_gitfiles.dir = $(call at.relto,$(topsrcdir),$(srcdir)) +_gitfiles.dir.all = $(patsubst $(_gitfiles.dir)/%,%,$(filter $(_gitfiles.dir)/%,$(_gitfiles.all))) +_gitfiles.dir.src = $(filter-out $(addsuffix /%,$(nested.subdirs)),$(_gitfiles.dir.all)) -- cgit v1.2.3 From 8191cd39e9884464d526f48e8b85cf5b434d5dd5 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 6 Sep 2016 23:14:55 -0400 Subject: (systemd) gitfiles: mv Makefile-src.mk gitfiles.mk --- build-aux/Makefile.once.head/00-gitfiles.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-aux/Makefile.once.head/00-gitfiles.mk') diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk index 95437aa..b17b63a 100644 --- a/build-aux/Makefile.once.head/00-gitfiles.mk +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -16,7 +16,7 @@ mod.gitfiles.description = Automatically populate files.src.src from git mod.gitfiles.depends += files nested write-ifchanged quote -gitfiles.file ?= Makefile-src.mk +gitfiles.file ?= gitfiles.mk _gitfiles.all = -include $(topsrcdir)/$(gitfiles.file) -- cgit v1.2.3 From 95d18493a5d3399993053b94cb1fc4542699f884 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 28 Oct 2016 12:45:33 -0400 Subject: (systemd) Autothing documentation --- build-aux/Makefile.once.head/00-gitfiles.mk | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'build-aux/Makefile.once.head/00-gitfiles.mk') diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk index b17b63a..faae91d 100644 --- a/build-aux/Makefile.once.head/00-gitfiles.mk +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -15,6 +15,47 @@ mod.gitfiles.description = Automatically populate files.src.src from git mod.gitfiles.depends += files nested write-ifchanged quote +mod.gitfiles.files += $(topsrcdir)/$(gitfiles.file) +define mod.gitfiles.doc +# Inputs: +# - Global variable : `gitfiles.file` (Default: gitfiles.mk) +# - Directory variable : `nested.subdirs` +# - External : git +# Outputs: +# - File : `$(topsrcdir)/$(gitfiles.file)` +# - Directory variable : `files.src.src` +# - Directory variable : `files.src.gen` (only in top dir) +# +# The `files` module has a variable (`files.src.src`) that you (the +# developer) set to list "pure" source files; the type of files that you +# would check into a version control system. Since you are a +# responsible developer, you use a version control system. Since the +# computer is already maintaining a list of these files *in the VCS*, +# why should you--a filthy human--need to also maintain the list? Enter +# gitfiles, which will talk to git to maintain `files.src.src`, but +# won't require that the git repository be distributed to +# installing-users. +# +# If `$(topsrcdir)/.git` exists, then it will generate +# `$(topsrcdir)/$(gitfiles.file)`. Otherwise, it will assume that +# `$(topsrcdir)/$(gitfiles.file)` already exists. +# +# It will use the information in `$(topsrcdir)/$(gitfiles.file)` to +# append to `files.src.src` in each directory +# +# Finally, since the generated `$(topsrcdir)/$(gitfiles.file)` must be +# distributed to users, it is added to $(topsrcdirs)'s `files.src.gen`. +# +# When setting `files.src.src`, it needs to know which files "belong" to +# the current directory directly, and which "belong" to a further +# subdirectory. To do this, it uses an expression involving +# `$(nested.subdirs)`. +# +# While gitfiles sets `files.src.src` very early +# in `each.head`, because `nested.subdirs` might not be set yet, it may +# or may not be safe to use the value of `$(files.src.src)` in your +# Makefile, depending on how you set `nested.subdirs`. +endef gitfiles.file ?= gitfiles.mk -- cgit v1.2.3 From 9384e763b00774603208b3d44977ed0e6762a09a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 30 Oct 2016 19:27:23 -0400 Subject: (systemd) at: mod: don't call on .doc --- build-aux/Makefile.once.head/00-gitfiles.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'build-aux/Makefile.once.head/00-gitfiles.mk') diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk index faae91d..1214e50 100644 --- a/build-aux/Makefile.once.head/00-gitfiles.mk +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -56,6 +56,7 @@ define mod.gitfiles.doc # or may not be safe to use the value of `$(files.src.src)` in your # Makefile, depending on how you set `nested.subdirs`. endef +mod.gitfiles.doc := $(value mod.gitfiles.doc) gitfiles.file ?= gitfiles.mk -- cgit v1.2.3 From 6819ff36a37ceb091cb793875e6f4529c0bccc1a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 15 Jan 2017 01:34:04 -0500 Subject: mod: gitfiles: doc: re-flow a paragraph --- build-aux/Makefile.once.head/00-gitfiles.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'build-aux/Makefile.once.head/00-gitfiles.mk') diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk index 1214e50..dbb4ae9 100644 --- a/build-aux/Makefile.once.head/00-gitfiles.mk +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -51,10 +51,10 @@ define mod.gitfiles.doc # subdirectory. To do this, it uses an expression involving # `$(nested.subdirs)`. # -# While gitfiles sets `files.src.src` very early -# in `each.head`, because `nested.subdirs` might not be set yet, it may -# or may not be safe to use the value of `$(files.src.src)` in your -# Makefile, depending on how you set `nested.subdirs`. +# While gitfiles sets `files.src.src` very early in `each.head`, because +# `nested.subdirs` might not be set yet, it may or may not be safe to +# use the value of `$(files.src.src)` in your Makefile, depending on how +# you set `nested.subdirs`. endef mod.gitfiles.doc := $(value mod.gitfiles.doc) -- cgit v1.2.3 From dd98e1c994520acc817d3dfa651ccf291827630d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 Jan 2017 02:20:31 -0500 Subject: Backport fixes from work on parabola-hackers.git. - core: Actually support at.Makefile; how it set the internal variable _at.MAKEFILE_LIST was broken if $(at.Makefile) != Makefile - mod: dist: * Don't try to distribute $(files.src.int) files. * Add a comment noting that the lack of the `-P` flag to `cp` is not a bug. - mod: gitfiles: * Correctly list files in $(topsrcdir). * Also enumerate files in git submodules. --- build-aux/Makefile.once.head/00-gitfiles.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'build-aux/Makefile.once.head/00-gitfiles.mk') diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk index dbb4ae9..8566a7f 100644 --- a/build-aux/Makefile.once.head/00-gitfiles.mk +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -1,4 +1,4 @@ -# Copyright (C) 2016 Luke Shumaker +# Copyright (C) 2016-2017 Luke Shumaker # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -65,10 +65,11 @@ _gitfiles.all = ifneq ($(wildcard $(topsrcdir)/.git),) $(topsrcdir)/$(gitfiles.file): _gitfiles.FORCE - @(cd $(@D) && git ls-files -z) | sed -z -e 's/\$$/\$$$$/g' -e 's/\n/$$(at.nl)/g' | xargs -r0 printf '_gitfiles.all+=%s\n' | $(WRITE_IFCHANGED) $@ + @(cd $(@D) && git ls-files --recurse-submodules -z) | sed -z -e 's/\$$/\$$$$/g' -e 's/\n/$$(at.nl)/g' | xargs -r0 printf '_gitfiles.all+=%s\n' | $(WRITE_IFCHANGED) $@ .PHONY: _gitfiles.FORCE endif _gitfiles.dir = $(call at.relto,$(topsrcdir),$(srcdir)) -_gitfiles.dir.all = $(patsubst $(_gitfiles.dir)/%,%,$(filter $(_gitfiles.dir)/%,$(_gitfiles.all))) +_gitfiles.pat = $(patsubst ./%,%,$(_gitfiles.dir)/%) +_gitfiles.dir.all = $(patsubst $(_gitfiles.pat),%,$(filter $(_gitfiles.pat),$(_gitfiles.all))) _gitfiles.dir.src = $(filter-out $(addsuffix /%,$(nested.subdirs)),$(_gitfiles.dir.all)) -- cgit v1.2.3