Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always generate version information #1210

Merged
merged 3 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ build/
**/*.cmd
**/*.a
*.elf
src/utils/src/version_gen.c
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the version file removed from .gitignore? It likely should not be committed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path to the generated file is build/src/utils/src/version_gen.c, that is not in the /src dir which means that it is already ignored by the build/ entry in .gitignore

4 changes: 2 additions & 2 deletions src/utils/src/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ obj-y += malloc.o
obj-y += version.o
version-objs := version_gen.o

src/utils/src/version_gen.c: src/utils/src/version.vtpl
$(PYTHON) $(srctree)/tools/make/versionTemplate.py --crazyflie-base $(srctree) $< $@
src/utils/src/version_gen.c: src/utils/src/version.vtpl FORCE
$(PYTHON) $(srctree)/tools/make/versionTemplate.py --crazyflie-base $(srctree) $< $@

###

Expand Down
16 changes: 2 additions & 14 deletions tools/kbuild/Makefile.kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,9 @@ endif
# Detect when mixed targets is specified, and make a second invocation
# of make so .config is not included in this case either (for *config).

version_h := include/generated/version.h

no-dot-config-targets := clean mrproper distclean \
cscope help% %docs check% coccicheck \
$(version_h) headers_% archheaders archscripts \
headers_% archheaders archscripts \
kernelversion %src-pkg

config-targets := 0
Expand Down Expand Up @@ -614,7 +612,7 @@ endif
# prepare2 creates a makefile if using a separate output directory
prepare2: prepare3 outputmakefile

prepare1: prepare2 $(version_h) include/config/auto.conf
prepare1: prepare2 include/config/auto.conf

archprepare:

Expand All @@ -630,16 +628,6 @@ prepare: prepare0
# KERNELRELEASE can change from a few different places, meaning version.h
# needs to be updated, so this check is forced on all builds

define filechk_version.h
(echo \#define firmware_VERSION_CODE $(shell \
expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
echo '#define firmware_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
endef

$(version_h): $(srctree)/Makefile FORCE
$(call filechk,version.h)


PHONY += headerdep
headerdep:
$(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
Expand Down