summaryrefslogtreecommitdiffstats
path: root/src/config/lib.in
blob: ad37262b3b45d69bc8a95576f6896725a05f0207 (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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
### config/lib.in
#
# Makefile fragment that creates static, shared, and profiled libraries.
#
# The following variables must be set in the Makefile.in:
#
# LIB		library name without "lib" or extension
# LIBMAJOR	library major version
# LIBMINOR	library minor version
# STOBJLISTS	list of files, each of which is an OBJS.ST created by
#			libobj.in; *DO NOT* use ./OBJS.ST for the current
#			directory as that will cause some makes to lose.
# SHLIB_EXPDEPS	list of libraries that this one has explicit
#			dependencies on, pref. in the form libfoo$(SHLIBEXT)
# SHLIB_EXPLIBS	list of libraries that this one has explicit
#			dependencies on, in "-lfoo" form.
# SHLIB_DIRS	list of directories where $(SHLIB_EXPLIBS) can be
#			found, in the form -Ldir1 -Ldir2 ...
#			since there are very few systems where -L is the
#			wrong thing (notable exception of SunOS but we
#			deal with it...)
# SHLIB_RDIRS	rpath directories to search; given in the
#			form dir1:dir2 ...
# RELDIR	path to this directory relative to $(TOPLIBD)

## Parameters to be set by configure:
##

LN_S=@LN_S@
AR=@AR@

# Set to "lib$(LIB)$(STEXT) lib$(LIB)$(SHEXT) lib$(LIB)$(PFEXT)" or
# some subset thereof by configure; determines which types of libs get
# built.
LIBLIST=@LIBLIST@

# Set by configure; list of library symlinks to make to $(TOPLIBD)
LIBLINKS=@LIBLINKS@

# Set by configure; list of install targets
LIBINSTLIST=@LIBINSTLIST@

# Set by configure; list of extra targets when cleaning
EXTRA_CLEAN_TARGETS=@EXTRA_CLEAN_TARGETS@
EXTRA_CLEAN_LINKS=@EXTRA_CLEAN_LINKS@

# Some of these should really move to pre.in, since programs will need
# it too. (e.g. stuff that has dependencies on the libraries)

# usually .a
STLIBEXT=@STLIBEXT@

# usually .so.$(LIBMAJOR).$(LIBMINOR)
SHLIBVEXT=@SHLIBVEXT@

# usually .so.$(LIBMAJOR) (to allow for major-version compat)
SHLIBSEXT=@SHLIBSEXT@

# usually .so
SHLIBEXT=@SHLIBEXT@

# usually _p.a
PFLIBEXT=@PFLIBEXT@

# "cc -G", "ld -Bshareable", etc.
LDCOMBINE=@LDCOMBINE@

# Misc args to tack on the tail of LDCOMBINE
LDCOMBINE_TAIL=@LDCOMBINE_TAIL@

# flags for explicit libraries depending on this one,
# e.g. "-R$(SHLIB_RPATH) $(SHLIB_SHLIB_DIRFLAGS) $(SHLIB_EXPLIBS)"
SHLIB_EXPFLAGS=@SHLIB_EXPFLAGS@

# STOBJLISTS=dir1/OBJS.ST dir2/OBJS.ST etc...
SHOBJLISTS=$(STOBJLISTS:.ST=.SH)
PFOBJLISTS=$(STOBJLISTS:.ST=.PF)

lib$(LIB)$(STLIBEXT): $(STOBJLISTS)
	$(RM) $@
	@echo "building static $(LIB) library"
	@dirs=`echo $(STOBJLISTS) | \
		sed -e 's%/OBJS.ST%%g' -e 's%OBJS.ST%.%'`; \
		$(AR) cq $@ `for d in $$dirs; do \
			sed -e '/^$$/d' -e "s%^%$$d/%" -e "s% % $$d/%g" \
				$$d/OBJS.ST; done`
	$(RANLIB) $@

lib$(LIB)$(SHLIBVEXT): $(SHOBJLISTS) $(SHLIB_EXPDEPS)
	$(RM) $@
	@echo "building shared $(LIB) library ($(LIBMAJOR).$(LIBMINOR))"
	@dirs=`echo $(SHOBJLISTS) | \
		sed -e 's%/OBJS.SH%%g' -e 's%OBJS.SH%.%'`; \
		$(LDCOMBINE) -o $@ `for d in $$dirs; do \
			sed -e '/^$$/d' -e "s%^%$$d/%" -e "s% % $$d/%g" \
				$$d/OBJS.SH; done` \
			$(SHLIB_EXPFLAGS) \
			$(LDCOMBINE_TAIL)
lib$(LIB)$(SHLIBSEXT): lib$(LIB)$(SHLIBVEXT)
	$(RM) $@
	$(LN_S) lib$(LIB)$(SHLIBVEXT) $@
lib$(LIB)$(SHLIBEXT): lib$(LIB)$(SHLIBVEXT)
	$(RM) $@
	$(LN_S) lib$(LIB)$(SHLIBVEXT) $@

lib$(LIB)$(PFLIBEXT): $(PFOBJLISTS)
	$(RM) $@
	@echo "building profiled $(LIB) library"
	@dirs=`echo $(PFOBJLISTS) | \
		sed -e 's%/OBJS.PF%%g' -e 's%OBJS.PF%.%'`; \
		$(AR) cq $@ `for d in $$dirs; do \
			sed -e '/^$$/d' -e "s%^%$$d/%" -e "s% % $$d/%g" \
				$$d/OBJS.PF; done`
	$(RANLIB) $@

$(TOPLIBD)/lib$(LIB)$(STLIBEXT): lib$(LIB)$(STLIBEXT)
	$(RM) $@
	(cd $(TOPLIBD) && $(LN_S) $(RELDIR)/lib$(LIB)$(STLIBEXT) .)
$(TOPLIBD)/lib$(LIB)$(SHLIBEXT): lib$(LIB)$(SHLIBEXT)
	$(RM) $@
	(cd $(TOPLIBD) && $(LN_S) $(RELDIR)/lib$(LIB)$(SHLIBEXT) .)
$(TOPLIBD)/lib$(LIB)$(SHLIBSEXT): lib$(LIB)$(SHLIBSEXT)
	$(RM) $@
	(cd $(TOPLIBD) && $(LN_S) $(RELDIR)/lib$(LIB)$(SHLIBSEXT) .)
$(TOPLIBD)/lib$(LIB)$(SHLIBVEXT): lib$(LIB)$(SHLIBVEXT)
	$(RM) $@
	(cd $(TOPLIBD) && $(LN_S) $(RELDIR)/lib$(LIB)$(SHLIBVEXT) .)
$(TOPLIBD)/lib$(LIB)$(PFLIBEXT): lib$(LIB)$(PFLIBEXT)
	$(RM) $@
	(cd $(TOPLIBD) && $(LN_S) $(RELDIR)/lib$(LIB)$(PFLIBEXT) .)

all-libs: $(LIBLIST)
all-liblinks: $(LIBLINKS)

all-framework:
	@echo lxs, put something here in config/lib.in for building frameworks
	@false

link-framework:
	@echo lxs, put something here in config/lib.in for symlinking frameworks
	@false

clean-libs: $(EXTRA_CLEAN_TARGETS)
	$(RM) lib$(LIB)$(STLIBEXT)
	$(RM) lib$(LIB)$(SHLIBVEXT)
	$(RM) lib$(LIB)$(SHLIBSEXT)
	$(RM) lib$(LIB)$(SHLIBEXT)
	$(RM) lib$(LIB)$(PFLIBEXT)

clean-liblinks: $(EXTRA_CLEAN_LINKS)
	$(RM) $(TOPLIBD)/lib$(LIB)$(STLIBEXT)
	$(RM) $(TOPLIBD)/lib$(LIB)$(SHLIBVEXT)
	$(RM) $(TOPLIBD)/lib$(LIB)$(SHLIBSEXT)
	$(RM) $(TOPLIBD)/lib$(LIB)$(SHLIBEXT)
	$(RM) $(TOPLIBD)/lib$(LIB)$(PFLIBEXT)

clean-framework:
	@echo lxs, put something here in config/lib.in for cleaning frameworks
	@false

clean-framework-link:
	@echo lxs, put something here in config/lib.in for cleaning framework links
	@false

install-libs: $(LIBINSTLIST)
install-static:
	$(RM) $(DESTDIR)$(KRB5_LIBDIR)/lib$(LIB)$(STLIBEXT)
	$(INSTALL_DATA) lib$(LIB)$(STLIBEXT) $(DESTDIR)$(KRB5_LIBDIR)
	$(RANLIB) $(DESTDIR)$(KRB5_LIBDIR)/lib$(LIB)$(STLIBEXT)
install-shared:
	$(RM) $(DESTDIR)$(KRB5_LIBDIR)/lib$(LIB)$(SHLIBVEXT)
	$(RM) $(DESTDIR)$(KRB5_LIBDIR)/lib$(LIB)$(SHLIBEXT)
	$(INSTALL_SHLIB) lib$(LIB)$(SHLIBVEXT) $(DESTDIR)$(KRB5_LIBDIR)
	(cd $(DESTDIR)$(KRB5_LIBDIR) && $(LN_S) lib$(LIB)$(SHLIBVEXT) \
		lib$(LIB)$(SHLIBEXT))
install-shlib-soname: install-shared
	$(RM) $(DESTDIR)$(KRB5_LIBDIR)/lib$(LIB)$(SHLIBSEXT)
	(cd $(DESTDIR)$(KRB5_LIBDIR) && $(LN_S) lib$(LIB)$(SHLIBVEXT) \
		lib$(LIB)$(SHLIBSEXT))
install-profiled:
	$(RM) $(DESTDIR)$(KRB5_LIBDIR)/lib$(LIB)$(PFLIBEXT)
	$(INSTALL_DATA) lib$(LIB)$(PFLIBEXT) $(DESTDIR)$(KRB5_LIBDIR)
	$(RANLIB) $(DESTDIR)$(KRB5_LIBDIR)/lib$(LIB)$(PFLIBEXT)

install-framework:
	@echo lxs, put something here in config/lib.in for installing frameworks
	@false

Makefile: $(SRCTOP)/config/lib.in
config.status: $(SRCTOP)/config/shlib.conf

# Use the following if links need to be made to $(TOPLIBD):
# all-unix:: all-liblinks
# install-unix:: install-libs
# clean-unix:: clean-liblinks clean-libs

# Use the following if links need not be made:
# all-unix:: all-libs
# install-unix:: install-libs
# clean-unix:: clean-libs

###
### end config/lib.in