xref: /illumos-gate/usr/src/lib/Makefile.targ (revision 1a2d662a91cee3bf82f41cd47c7ae6f3825d9db2)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23# Copyright (c) 2019, Joyent, Inc.
24#
25
26#
27# included to define local library targets
28#
29
30# conditional assignment of default permissions for the installed
31# DYNLIB/DYNLIBCCC.  Set here and in Makefile.mach, instead of Makefile.lib,
32# because ROOTLIBDIR may be changed in the including makefile after it has
33# included Makefile.lib.
34#
35$(ROOTLIBDIR)/$(DYNLIB) :=	FILEMODE= 755
36$(ROOTLIBDIR)/$(DYNLIBCCC) :=	FILEMODE= 755
37
38$(ROOTFS_LIBDIR)/$(DYNLIB) :=	FILEMODE= 755
39$(ROOTFS_LIBDIR)/$(DYNLIBCCC) :=	FILEMODE= 755
40
41$(ROOTLIBDIR64)/$(DYNLIB) :=	FILEMODE= 755
42$(ROOTLIBDIR64)/$(DYNLIBCCC) :=	FILEMODE= 755
43
44$(ROOTLIBPC) $(ROOTLIBPC64) :=	FILEMODE= 444
45
46# install rules
47$(ROOTHDRDIR)/%: $(HDRDIR)/%
48	$(INS.file)
49
50$(ROOTLIBDIR)/%: %
51	$(INS.file)
52$(ROOTLIBDIR64)/%: %
53	$(INS.file)
54$(ROOTFS_LIBDIR)/%: %
55	$(INS.file)
56$(ROOTFS_LIBDIR64)/%: %
57	$(INS.file)
58
59$(ROOTLIBDIR)/$(LIBLINKS): $(ROOTLIBDIR)/$(LIBLINKS)$(VERS)
60	$(INS.liblink)
61$(ROOTLIBDIR64)/$(LIBLINKS): $(ROOTLIBDIR64)/$(LIBLINKS)$(VERS)
62	$(INS.liblink64)
63
64$(ROOTLIBDIR)/$(LIBLINKSCCC): $(ROOTLIBDIR)/$(LIBLINKSCCC)$(VERS)
65	$(INS.liblinkccc)
66$(ROOTLIBDIR64)/$(LIBLINKSCCC): $(ROOTLIBDIR64)/$(LIBLINKSCCC)$(VERS)
67	$(INS.liblinkccc64)
68
69$(ROOTDEMODIRS):
70	$(INS.dir)
71$(ROOTDEMODIRBASE)/%: $(DEMOFILESRCDIR)/%
72	$(INS.file)
73
74objs/%.o pics/%.o: $(SRCDIR)/%.c
75	$(COMPILE.c) -o $@ $<
76	$(POST_PROCESS_O)
77
78objs/%.o pics/%.o: $(SRCDIR)/%.cc
79	$(COMPILE.cc) -o $@ $<
80	$(POST_PROCESS_CC_O)
81
82objs pics:
83	-@mkdir -p $@
84
85$(ROOTLIBPCDIR):
86	$(INS.dir)
87$(ROOTLIBPC): $(ROOTLIBPCDIR) $(PCFILE)
88	$(INS.file) $(PCFILE)
89$(ROOTLIBPCDIR64):
90	$(INS.dir)
91$(ROOTLIBPC64): $(ROOTLIBPCDIR64) $(PCFILE)
92	$(INS.file) $(PCFILE)
93%.pc: $(SRCDIR)/%.pc.in
94	$(RM) $@; \
95	$(SED)  -e "s@__LIBDIR__@$(PCLIBDIR)@g" \
96		-e "s@__VERSPKG__@$(VERSPKG)@g" \
97		< $< > $@
98
99$(LIBRARY): objs .WAIT $$(OBJS)
100	$(BUILD.AR)
101	$(POST_PROCESS_A)
102
103$(DYNLIB): $$(MAPFILES)
104
105$(DYNLIB): pics .WAIT $$(PICS) $$(ALTPICS) $$(EXTPICS)
106	$(BUILD.SO)
107	$(POST_PROCESS_SO)
108
109$(DYNLIBCCC): pics .WAIT $$(PICS) $$(ALTPICS) $$(EXTPICS)
110	$(BUILDCCC.SO)
111	$(POST_PROCESS_SO)
112
113$(TYPECHECK): $(TYPECHECK_LIB32) $(TYPECHECK_LIB64)
114	$(TYPECHECK.lib)
115
116clobber: clean
117	-$(RM) $(CLOBBERTARGFILES)
118
119clean:
120	-$(RM) $(OBJS) $(PICS) $(DUPLICATE_SRC) $(CLEANFILES)
121
122$(ROOTCOMPATLINKS):
123	$(RM) $@; $(SYMLINK) $(COMPATLINKTARGET) $@
124
125$(ROOTCOMPATLINKS64):
126	$(RM) $@; $(SYMLINK) $(COMPATLINKTARGET) $@
127
128