1LOCAL_DIR := $(GET_LOCAL_DIR)
2
3MODULE := $(LOCAL_DIR)
4
5MODULE_SRCS += \
6	$(LOCAL_DIR)/version.c
7
8# if no one else has defined it by now, build us a default buildid
9# based on the current time.
10# suffix it with _LOCAL if OFFICIAL_BUILD is unset
11ifeq ($(strip $(BUILDID)),)
12ifneq ($(OFFICIAL_BUILD),)
13BUILDID := "$(shell $(LOCAL_DIR)/buildid.sh)"
14else
15BUILDID := "$(shell $(LOCAL_DIR)/buildid.sh)_LOCAL"
16endif
17endif
18
19# Generate a buildid.h file, lazy evaluate BUILDID_DEFINE at the end
20# of the first make pass. This lets modules that haven't been
21# included yet set BUILDID.
22BUILDID_DEFINE="BUILDID=\"$(BUILDID)\""
23BUILDID_H := $(BUILDDIR)/buildid.h
24$(BUILDID_H): buildid_h.phony
25	@$(call MAKECONFIGHEADER,$@,BUILDID_DEFINE)
26
27# Moving the phony to an extra dependency allows version.o not to be
28# rebuilt if buildid.h doesn't change.
29buildid_h.phony:
30.PHONY: buildid_h.phony
31
32GENERATED += $(BUILDID_H)
33
34# make sure the module properly depends on and can find buildid.h
35MODULE_SRCDEPS := $(BUILDID_H)
36
37include make/module.mk
38