Makefile 1.29 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
include $(BUILDDIR)/distcfg.mk
18 19
include $(BUILDDIR)/functions.mk

20 21
SUFFIX := pkg/lists
TARGET := $(BUILDDIR)/$(SUFFIX)
Michael Shigorin's avatar
Michael Shigorin committed
22

23
all: | $(TARGET) $(GLOBAL_DEBUG) copy-lists copy-groups grep-archdep
Michael Shigorin's avatar
Michael Shigorin committed
24
	@mp-commit "$(TARGET)" "requested $(SUFFIX) copied over"
25

26
# env | sort -u | grep _LISTS | xargs -r cp -t
27
copy-lists:
28 29 30 31
	@echo $(foreach V, \
		$(filter %_LISTS,$(sort $(.VARIABLES))), \
		$(if $(filter environment% file,$(origin $V)),$($V))) \
	| xargs -r -- cp --parents -at $(TARGET) --
32

33
copy-groups: PKGDIR = ..
34
copy-groups:
35 36
	@echo $(call groups2lists) \
	| xargs -r -- cp --parents -at $(TARGET) --
37

38 39
grep-archdep:
	@find $(TARGET) -type f \
40
	| xargs -r -I __ -- archdep-filter -a "$(ARCH)" -i __
41

42 43 44
# do beforehand as foreach gets expanded before recipe execution
$(TARGET):
	@mkdir -p $(TARGET)
Michael Shigorin's avatar
Michael Shigorin committed
45

46
# figure out *_LISTS variables and print them out nicely
Michael Shigorin's avatar
Michael Shigorin committed
47
debug:
48
	@echo -e $(foreach V, \
Michael Shigorin's avatar
Michael Shigorin committed
49 50
		$(filter %_LISTS,$(sort $(.VARIABLES))), \
		$(if $(filter environment% file,$(origin $V)),\
51
			$(shell echo '\\n"**"' $V: $($V)))) '\n'
52 53

endif