File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed
examples/tutorials/dynamic-apps-and-policies/app_loader Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -22,20 +22,25 @@ APPS_TO_EMBED := \
22
22
23
23
BINARY_COUNT = $(words $(APPS_TO_EMBED ) )
24
24
AUTOGEN_HEADER = loadable_binaries.h
25
- APPS_HASH := build/apps_to_embed
26
- .PHONY : $(APPS_HASH )
27
25
main.c : $(AUTOGEN_HEADER )
28
26
29
- $(APPS_HASH ) :
30
- @mkdir -p $(dir $@ )
31
- @echo ' $(APPS_TO_EMBED)' > $@ .tmp
32
- @if [ ! -f $@ ] || ! cmp -s $@ $@ .tmp; then \
33
- mv $@ .tmp $@ ; \
34
- else \
35
- rm $@ .tmp; \
36
- fi
37
27
38
- $(AUTOGEN_HEADER ) : $(APPS_HASH )
28
+ build :
29
+ $(TRACE_DIR )
30
+ @mkdir -p $@
31
+
32
+ # Ensure we rebuild if `APPS_TO_EMBED` changes.
33
+ .PHONY : FORCE
34
+ define DEPENDABLE_VAR
35
+ build/$(1 ) : build
36
+ @printf '%s' "$($(1 ) ) " > build/$(1 )
37
+ ifneq ("$(shell cat build/$(1 ) 2>/dev/null) ","$($(1 ) ) ")
38
+ build/$(1 ) : FORCE
39
+ endif
40
+ endef
41
+ $(eval $(call DEPENDABLE_VAR,APPS_TO_EMBED))
42
+
43
+ $(AUTOGEN_HEADER ) : build/APPS_TO_EMBED
39
44
@echo " // \` app_loader\` 's makefile autogenerates this file. Do not edit manually." > $(AUTOGEN_HEADER )
40
45
@echo " #pragma once" >> $(AUTOGEN_HEADER )
41
46
@echo " " >> $(AUTOGEN_HEADER )
You can’t perform that action at this time.
0 commit comments