Makefile 1.15 KB
Newer Older
Michael Shigorin's avatar
Michael Shigorin committed
1 2
# step 3: copy package lists referenced in distro configuration
#         (and only those!) over to $(BUILDDIR)
Michael Shigorin's avatar
Michael Shigorin committed
3

4
ifndef BUILDDIR
5 6 7 8 9 10 11 12 13 14 15

pkgdups:
	@find -type f ! -name README ! -name Makefile \
	| grep -v '~$$' \
	| sed 's,^\./,,g' \
	| xargs ../../bin/pkgdups

%:
	$(error BUILDDIR not defined)

else
16

17 18 19
include $(BUILDDIR)/distcfg.mk
SUFFIX := pkg/lists
TARGET := $(BUILDDIR)/$(SUFFIX)
Michael Shigorin's avatar
Michael Shigorin committed
20

21
all: $(TARGET) $(GLOBAL_DEBUG) $(DOTBASE) copy-lists copy-groups
Michael Shigorin's avatar
Michael Shigorin committed
22
	@mp-commit "$(TARGET)" "requested $(SUFFIX) copied over"
23 24

copy-lists:
25
	@# env | sort -u | grep _LISTS | xargs cp
Michael Shigorin's avatar
Michael Shigorin committed
26 27 28
	@$(foreach V, \
		$(filter %_LISTS,$(sort $(.VARIABLES))), \
		$(if $(filter environment% file,$(origin $V)),\
29
			$(shell cp --parents -at $(TARGET) -- $($V))))
30

31 32 33 34 35
copy-groups:
	@if [ -n "$(THE_GROUPS)$(MAIN_GROUPS)" ]; then \
		cp -at $(TARGET) -- $(THE_GROUPS) $(MAIN_GROUPS); \
	fi

36 37 38
# do beforehand as foreach gets expanded before recipe execution
$(TARGET):
	@mkdir -p $(TARGET)
Michael Shigorin's avatar
Michael Shigorin committed
39

40
# figure out *_LISTS variables and print them out nicely
Michael Shigorin's avatar
Michael Shigorin committed
41
debug:
42
	@echo -e $(foreach V, \
Michael Shigorin's avatar
Michael Shigorin committed
43 44
		$(filter %_LISTS,$(sort $(.VARIABLES))), \
		$(if $(filter environment% file,$(origin $V)),\
45
			$(shell echo '\\n"**"' $V: $($V)))) '\n'
46 47

endif