]> rtime.felk.cvut.cz Git - l4.git/blob - l4/mk/install.inc
f311ea977d2c22aafb772de06a79a327626b9e20
[l4.git] / l4 / mk / install.inc
1 # -*- Makefile -*-
2 # vim:set ft=make:
3 #
4 # DROPS (Dresden Realtime OPerating System) Component
5 #
6 # Makefile-Include for install-rules
7 #
8 # This file is useful only when actually building files, thus if
9 # BUILD_ONE_ARCHITECTURE (see Makeconf) is defined.
10 # INSTALL_TARGET and INSTALL_TARGET_$(ARCH) contain the targets to be
11 # installed. If they are both empty, and NOTARGETSTOINSTALL is not set,
12 # they are set to TARGET and TARGET_$(ARCH).
13 #
14 # INSTALLDIR and INSTALLDIR_LOCAL is the dir the files will be installed 
15 # in and must be set prior to including this file. INSTALLDIR is used by the
16 # target "install" and "INSTALLDIR_LOCAL" by the target "all".
17 #
18 # The target "all" is made depending on the installed files in
19 # INSTALLDIR_LOCAL. "install" on the files in INSTALLDIR. An other
20 # difference is that "all" results in using the variable
21 # $(INSTALLFILE_LOCAL) to install the files and "install" in using
22 # $(INSTALLFILE). This allows the difference between linking and actually
23 # copying (with stripping for bins).
24
25 ifndef INSTALL_TARGET_$(OSYSTEM)
26 ifndef NOTARGETSTOINSTALL
27 INSTALL_TARGET?=$(TARGET)
28 endif
29 endif
30 INSTALL_TARGET += $(INSTALL_TARGET_$(OSYSTEM))
31
32 all::   $(addprefix $(INSTALLDIR_LOCAL)/,$(INSTALL_TARGET))
33 install:: $(addprefix $(INSTALLDIR)/,$(INSTALL_TARGET))
34
35 # with prog.mk, we copy
36 ifeq ($(ROLE),prog.mk)
37 $(foreach f,$(INSTALL_TARGET),$(INSTALLDIR_LOCAL)/$(f)):$(INSTALLDIR_LOCAL)/%:%
38         @$(INSTALL_LOCAL_MESSAGE)
39         $(if $(INSTALLFILE_LOCAL),$(VERBOSE)$(INSTALL) -d $(dir $@))
40         $(VERBOSE)$(call INSTALLFILE_LOCAL,$<,$@)
41 else
42 # with others, we symlink
43 # we check for each locally installed lib if the symlink is correct or if
44 # it's a shared lib since we need to always call the local install rule as
45 # we need to load shared libs to the target
46 .PHONY: $(addprefix $(INSTALLDIR_LOCAL)/,$(INSTALL_TARGET))
47 $(foreach f,$(INSTALL_TARGET),$(INSTALLDIR_LOCAL)/$(f)):$(INSTALLDIR_LOCAL)/%:%
48         @$(if $(INSTALLFILE_LOCAL), \
49                 f="$@"; \
50                 if [ ! $< -ef $@ -o "$${f%%.so}" != "$$f" ] ; then \
51                   $(if $(INSTALL_LOCAL_MESSAGE),$(INSTALL_LOCAL_MESSAGE);) \
52                   $(INSTALL) -d $(dir $@); \
53                   $(call INSTALLFILE_LOCAL,$<,$@); \
54                 fi)
55 endif
56
57 $(foreach f,$(INSTALL_TARGET),$(INSTALLDIR)/$(f)):$(INSTALLDIR)/%:%
58         @$(INSTALL_MESSAGE)
59         $(if $(INSTALLFILE),$(VERBOSE)$(INSTALL) -d $(dir $@))
60         $(VERBOSE)$(call INSTALLFILE,$<,$@)
61
62 # unconditionally install on "make install"
63 .PHONY: $(addprefix $(INSTALLDIR)/,$(INSTALL_TARGET))
64
65 .general.d: $(L4DIR)/mk/install.inc
66