File: headers.make

package info (click to toggle)
gnustep-make 2.0.6-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,272 kB
  • ctags: 159
  • sloc: perl: 15,898; sh: 4,046; makefile: 275; csh: 48; objc: 27
file content (133 lines) | stat: -rw-r--r-- 4,220 bytes parent folder | download
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#
#   Shared/headers.make
#
#   Makefile fragment with rules to install header files
#
#   Copyright (C) 2002 Free Software Foundation, Inc.
#
#   Author:  Nicola Pero <nicola@brainstorm.co.uk> 
#
#   This file is part of the GNUstep Makefile Package.
#
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License
#   as published by the Free Software Foundation; either version 3
#   of the License, or (at your option) any later version.
#   
#   You should have received a copy of the GNU General Public
#   License along with this library; see the file COPYING.
#   If not, write to the Free Software Foundation,
#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

#
# input variables:
#
#  $(GNUSTEP_INSTANCE)_HEADER_FILES : the list of .h files to install
#
#  $(GNUSTEP_INSTANCE)_HEADER_FILES_DIR : the dir in which the .h files are;
#  defaults to `.' if no set.
#
#  $(GNUSTEP_INSTANCE)_HEADER_FILES_INSTALL_DIR : the dir in which to install
#  the .h files; defaults to $(GNUSTEP_INSTANCE) if not set.  Please set it 
#  to `.' if you want it to be like empty.
#

#
# public targets:
# 
#  shared-instance-headers-install 
#  shared-instance-headers-uninstall
#

HEADER_FILES = $($(GNUSTEP_INSTANCE)_HEADER_FILES)

.PHONY: \
shared-instance-headers-install \
shared-instance-headers-uninstall

# We always compute HEADER_FILES_DIR and HEADER_FILES_INSTALL_DIR.
# The reason is that frameworks might have headers in subprojects (and
# not in the top framework makefile!).  Those headers are
# automatically used and installed, but in the top-level makefile,
# HEADER_FILES = '', still you might want to have a special
# HEADER_FILES_DIR and HEADER_FILES_INSTALL_DIR even in this case.
# NB: Header installation for frameworks is done by the framework
# code.
HEADER_FILES_DIR = $($(GNUSTEP_INSTANCE)_HEADER_FILES_DIR)

ifeq ($(HEADER_FILES_DIR),)
  HEADER_FILES_DIR = .
endif

HEADER_FILES_INSTALL_DIR = $($(GNUSTEP_INSTANCE)_HEADER_FILES_INSTALL_DIR)

# Please use `.' to force it to stay empty
ifeq ($(HEADER_FILES_INSTALL_DIR),)
  HEADER_FILES_INSTALL_DIR = $(GNUSTEP_INSTANCE)
endif

ifeq ($(HEADER_FILES),)

shared-instance-headers-install:

shared-instance-headers-uninstall:

else # we have some HEADER_FILES

#
# We provide two different algorithms of installing headers.
#

ifeq ($(GNUSTEP_DEVELOPER),)

# 
# The first one is the standard one.  We run a subshell, loop on all the
# header files, and install all of them.  This is the default one.
#

shared-instance-headers-install: $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR)
	$(ECHO_INSTALLING_HEADERS)for file in $(HEADER_FILES) __done; do \
	  if [ $$file != __done ]; then \
	    $(INSTALL_DATA) $(HEADER_FILES_DIR)/$$file \
	          $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR)/$$file; \
	  fi; \
	done$(END_ECHO)

else

# 
# The second one (which you activate by setting GNUSTEP_DEVELOPER to
# YES in your shell) is the one specifically optimized for faster
# development.  We only install headers which are newer than the
# installed version.  This is much faster if you are developing and
# need to install headers often, and normally with just few changes.
# It is slower the first time you install the headers, because we
# install them using a lot of subshell processes (which is why it is not
# the default - `users' install headers only once - the default
# setup is for users).
#

shared-instance-headers-install: \
  $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR) \
  $(addprefix $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR)/,$(HEADER_FILES))

$(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR)/% : $(HEADER_FILES_DIR)/%
	$(ECHO_NOTHING)$(INSTALL_DATA) $< $@$(END_ECHO)

endif

$(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR):
	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)


shared-instance-headers-uninstall:
	$(ECHO_NOTHING)for file in $(HEADER_FILES) __done; do \
	  if [ $$file != __done ]; then \
	    rm -rf $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR)/$$file ; \
	  fi; \
	done$(END_ECHO)

# TODO - during uninstall, it would be pretty to remove
# $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR) if it's empty.

endif # HEADER_FILES = ''