topdir.mk: Add target gitignore
Add a target gitignore to topdir.mk, which blasts jw-pkg's default idea of how .gitignore should look like into $(TOPDIR)/.gitignore. It's not a prerequisite of any other target, because it's not meant to run automatically. The idea is to keep some central maintenance of what should be in there from jw-pkg's perspective, make it convenvient to update, but leave the final decision to the commiter of any project using the machinery. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
bf3484c2c9
commit
bf636f8b71
2 changed files with 65 additions and 0 deletions
55
conf/templates/gitignore
Normal file
55
conf/templates/gitignore
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{top}
|
||||
*.a
|
||||
*.dep.mk
|
||||
*.dist
|
||||
*.done
|
||||
*.jw-secret
|
||||
*.jw-secret-file
|
||||
*.ldscript
|
||||
*.o
|
||||
*.old
|
||||
*.orig
|
||||
*.out
|
||||
*.pc
|
||||
*.pyc
|
||||
*.rep
|
||||
*.secret
|
||||
*.so
|
||||
*.so.*
|
||||
*.swp
|
||||
*_generated_*
|
||||
*tmp*
|
||||
*~
|
||||
-test-out.txt
|
||||
.cache-project.mk
|
||||
.exrc
|
||||
.feedfs_history
|
||||
.gdb_history
|
||||
.jw-agit
|
||||
.mypy_cache
|
||||
.ruff_cache
|
||||
__init__.py
|
||||
__pycache__
|
||||
bin/*.bat
|
||||
bin/*.pl
|
||||
bin/*.pm
|
||||
bin/*.py
|
||||
bin/*.sh
|
||||
bin/*.tcl
|
||||
conftest.py
|
||||
core
|
||||
dist
|
||||
ld-*.conf
|
||||
local.conf
|
||||
local.mk
|
||||
local.mk
|
||||
local.yaml
|
||||
make/*.pc
|
||||
mkspec.sh
|
||||
pr-descr*.txt
|
||||
pre-local.mk
|
||||
pyproject.toml
|
||||
pyrightconfig.json
|
||||
!*.jw-tmpl
|
||||
!*.tmpl
|
||||
{end}
|
||||
|
|
@ -99,6 +99,9 @@ JW_PKG_TMPL_SEARCH_PATH ?= $(JW_PKG_CONF_BASE_DIR)/templates
|
|||
JW_PKG_TMPL_UPDATE ?= $(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py -p $(PROJECTS_DIR) -t $(TOPDIR) --topdir-format unaltered \
|
||||
projects create-file --format tmpl --search-path $(subst $(space),:,$(JW_PKG_TMPL_SEARCH_PATH)) --template-name
|
||||
|
||||
GITIGNORE_PATTERNS_TOP ?= $(PROJECT)
|
||||
GITIGNORE_PATTERNS_END ?= $(addprefix !,$(shell git ls-files 2>/dev/null | grep "\(\b$(PROJECT)\b\|__init__.py\)" | xargs))
|
||||
|
||||
all: topdir config
|
||||
test: all
|
||||
|
||||
|
|
@ -311,3 +314,10 @@ Makefile: ;
|
|||
%: $(TD_COPY_SRC)/% $$(foreach path,$$(TD_COPY_SRC_PATH),$$(wildcard $$(addprefix $$(path)/,$$@))) $$(wildcard $$@.*)
|
||||
cat $^ > $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
gitignore:
|
||||
$(JW_PKG_TMPL_UPDATE) gitignore --field-keys top,end \
|
||||
$(addprefix --field top=,$(GITIGNORE_PATTERNS_TOP)) \
|
||||
$(addprefix --field end=,$(GITIGNORE_PATTERNS_END)) \
|
||||
--field-separator='%n' $(PROJECT) | grep -v '^[[:space:]]*$$' > .gitignore.tmp
|
||||
mv .gitignore.tmp .gitignore
|
||||
|
|
|
|||
Loading…
Reference in a new issue