summaryrefslogtreecommitdiff
path: root/package/targets.mak
blob: a7a1fd993a56833020af2d36706a742296e5894e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
LIBEXEC_TARGETS :=

LIB_DEFS := EXECLINE=execline

ifeq ($(MULTICALL),1)

BIN_TARGETS := execline
CONTENTS := $(notdir $(wildcard src/execline/deps-exe/*))
BIN_SYMLINKS := cd umask $(CONTENTS)
EXTRA_TARGETS += src/multicall/execline.c

define symlink_definition
SYMLINK_TARGET_$(1) := execline
endef
$(foreach name,$(BIN_SYMLINKS),$(eval $(call symlink_definition,$(name))))

src/multicall/execline.c: tools/gen-multicall.sh $(CONTENTS:%=src/$(package)/%.c)
	./tools/gen-multicall.sh > src/multicall/execline.c

src/multicall/execline.o: src/multicall/execline.c src/include/execline/config.h src/include/execline/execline.h

else

BIN_TARGETS := $(notdir $(wildcard src/execline/deps-exe/*))
BIN_SYMLINKS := cd umask

ifeq ($(PEDANTIC_POSIX),1)
SYMLINK_TARGET_cd := posix-cd
SYMLINK_TARGET_umask := posix-umask
else
SYMLINK_TARGET_cd := execline-cd
SYMLINK_TARGET_umask := execline-umask
endif

$(DESTDIR)$(bindir)/define: ./define package/modes
	exec $(INSTALL) -D -m 600 $< $@
	grep -- ^$(@F) < package/modes | { read name mode owner && \
	if [ x$$owner != x ] ; then chown -- $$owner $@ ; fi && \
	chmod $$mode $@ ; }

endif