File: program.mk

package info (click to toggle)
libreswan 5.2-2.3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 81,644 kB
  • sloc: ansic: 129,988; sh: 32,018; xml: 20,646; python: 10,303; makefile: 3,022; javascript: 1,506; sed: 574; yacc: 511; perl: 264; awk: 52
file content (75 lines) | stat: -rw-r--r-- 1,924 bytes parent folder | download | duplicates (2)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Make life easy, just include everything that is needed.

ifndef top_srcdir
include $(dir $(lastword $(MAKEFILE_LIST)))dirs.mk
endif

# Unless PROGRAM_MANPAGE has been pre-defined (only done by whack and
# only to suppress its man page), force MANPAGES to include a MANPAGE
# for this program.

PROGRAM_MANPAGE ?= $(addprefix ipsec-, $(addsuffix .8, $(PROGRAM)))
MANPAGES += $(PROGRAM_MANPAGE)

include $(top_srcdir)/mk/config.mk
include $(top_srcdir)/mk/version.mk
include $(top_srcdir)/mk/targets.mk
include $(top_srcdir)/mk/manpages.mk

ifneq ($(LD_LIBRARY_PATH),)
LDFLAGS+=-L$(LD_LIBRARY_PATH)
endif

ifndef PROGRAMDIR
PROGRAMDIR=$(DESTDIR)$(LIBEXECDIR)
endif

local-base: $(PROGRAM)

local-clean-base:
	rm -f $(builddir)/*.o $(foreach p,$(PROGRAM), $(builddir)/$(p))

src-file = $(firstword $(wildcard $(srcdir)/$(1) $(builddir)/$(1)))

foreach-file = set -eu ; $(foreach f, $(1), \
		file=$(f) ; \
		destdir=$(strip $(2)) ; \
		src=$(call src-file,$(f)) ; \
		$(3) \
	)

local-install-base:
	@$(call foreach-file, $(PROGRAM),  $(PROGRAMDIR), \
		echo $$src '->' $$destdir/$$file ; \
		mkdir -p $$destdir ; \
		$(INSTALL) $(INSTBINFLAGS) $$src $$destdir/$$file ; \
	)

list-local-base:
	@$(call foreach-file, $(PROGRAM), $(PROGRAMDIR), \
		echo $$destdir/$$file ; \
	)

ifdef OBJS

# To avoid problems with implicit make rules creating and then
# deleting $(PROGRAM).o, $(OBJS) must include the main object
# (typically $(PROGRAM).o).  Since there is no difference between how
# objects and archives are handled, $(OBJS) includes both.  Duplicate
# archives do no harm.
#
# Need to depend on Makefile so that when $(OBJS) changes (for
# instance something is removed), a re-link is triggered.

$(PROGRAM): $(OBJS) $(srcdir)/Makefile
	cd $(builddir) && \
	$(CC) $(USERLAND_CFLAGS) \
		$(USERLAND_INCLUDES) \
		$(CFLAGS) \
		-o $@ $(OBJS) \
		$(USERLAND_LDFLAGS) \
		$(LDFLAGS)

endif

include $(top_srcdir)/mk/rules.mk