1#ident "@(#)rules.shl	1.23 21/04/28 "
2###########################################################################
3# Written 1996-2018 by J. Schilling
4###########################################################################
5#
6# Rules for shared (dynamic) libraries
7#
8# SUBARCHDIR must be before any other definitions
9#
10###########################################################################
11# Copyright (c) J. Schilling
12###########################################################################
13# The contents of this file are subject to the terms of the
14# Common Development and Distribution License, Version 1.0 only
15# (the "License").  You may not use this file except in compliance
16# with the License.
17#
18# See the file CDDL.Schily.txt in this distribution for details.
19# A copy of the CDDL is also available via the Internet at
20# http://www.opensource.org/licenses/cddl1.txt
21#
22# When distributing Covered Code, include this CDDL HEADER in each
23# file and include the License file CDDL.Schily.txt from this distribution.
24###########################################################################
25
26SUBARCHDIR=		/pic
27COPTS +=		$(COPTDYN)
28C++OPTS +=		$(C++OPTDYN)
29LDOPTS +=		$(LDOPTDYN)
30LDLIBS +=		$(LDLIBDYN)
31
32###########################################################################
33include		$(SRCROOT)/$(RULESDIR)/rules.obj
34###########################################################################
35
36###########################################################################
37# This must be before first use of $(SHL_SUFFIX)
38###########################################################################
39_DYNMAJOR=	$(_UNIQ)$(SHL_MAJOR)
40__DYNMAJOR=	$(_DYNMAJOR:$(_UNIQ)=1)
41DYNMAJOR=	$(__DYNMAJOR:$(_UNIQ)%=%)
42
43_DYNMINOR=	$(_UNIQ)$(SHL_MINOR)
44__DYNMINOR=	$(_DYNMINOR:$(_UNIQ)=0)
45DYNMINOR=	$(__DYNMINOR:$(_UNIQ)%=%)
46
47TARGET=		$(LIB_PREFIX)$(TARGETLIB)$(SHL_SUFFIX)
48TARGET_BASE=	$(LIB_PREFIX)$(TARGETLIB)
49TARGET_PATH=	$(OLIBSDIR)
50PTARGET=	$(OLIBSDIR)/$(TARGET)
51PTARGET_BASE=	$(OLIBSDIR)/$(TARGET_BASE)
52
53_MAPVERS=	lib$(TARGETLIB)-mapvers
54#MAPVERS=	$(_MAPVERS)	# Use this in *-os-*cc*.rul to enable mapfiles
55PMAPVERS=	$(MAPVERS:%=$(ARCHDIR)/$(MAPVERS))
56
57$(PTARGET):	$(PMAPVERS)
58
59#
60# $(PMAPVERS) may be empty and POSIX does not permit empty target lists.
61# We add an impossible target to make sure there is no empty target.
62#
63$(PMAPVERS) No/TaR/GeT:	$(MAPVERS)
64			$(NOECHO)echo "	==> LOCALIZING mapfile \"$@\""; \
65			$(CPPX) $(CPP_FLAGS) $(CPPFLAGS) $(CPPX_IN) $^ | \
66			tr -d '"' $(MAPFILE_POST) > $@ || $(RM) $(RM_FORCE) $@
67
68_INSMODEI=	$(_UNIQ)$(INSMODE)
69__INSMODEI=	$(_INSMODEI:$(_UNIQ)=$(INSMODEF))
70INSMODEI=	$(__INSMODEI:$(_UNIQ)%=%)
71
72__DYNLD.o=	$(_UNIQ)$(DYNLD.o)
73___DYNLD.o=	$(__DYNLD.o:$(_UNIQ)=$(DYNLD) -o $@ $(LDFLAGS) `$(LORDER) $(POFILES) | $(TSORT)` $(LDLIBS))
74_DYNLD.o=	$(___DYNLD.o:$(_UNIQ)%=%)
75
76all:		$(TARGET_PATH) $(PTARGET)
77
78$(TARGET_PATH):
79		$(MKDIR) -p $@
80
81$(PTARGET):	$(OFILES)
82			$(_DYNLD.o)
83			-$(LNDYNLIB)
84
85SYMLINKS +=	$(TARGET_BASE).so
86
87#			$(NOECHO)$(RM) $(RM_FORCE) $(PTARGET_BASE).so; $(SYMLINK) $(TARGET) $(PTARGET_BASE).so
88
89###########################################################################
90include		$(SRCROOT)/$(RULESDIR)/sub.htm
91include		$(SRCROOT)/$(RULESDIR)/rules.clr
92include		$(SRCROOT)/$(RULESDIR)/rules.ins
93include		$(SRCROOT)/$(RULESDIR)/rules.tag
94include		$(SRCROOT)/$(RULESDIR)/rules.hlp
95include		$(SRCROOT)/$(RULESDIR)/rules.dep
96###########################################################################
97