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#
23# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
27#
28
29include		../../../../../lib/Makefile.lib
30include		../../../Makefile.com
31
32CAP_LIB=	cap.so
33CAP_OBJ=	cap_msg.o cap32.o cap64.o
34
35DYN_LIB=	dyn.so
36DYN_OBJ=	dyn_msg.o dyn32.o dyn64.o
37
38EHDR_LIB=	ehdr.so
39EHDR_OBJ=	ehdr_msg.o ehdr32.o ehdr64.o
40
41PHDR_LIB=	phdr.so
42PHDR_OBJ=	phdr_msg.o phdr32.o phdr64.o
43
44SHDR_LIB=	shdr.so
45SHDR_OBJ=	shdr_msg.o shdr32.o shdr64.o
46
47STR_LIB=	str.so
48STR_OBJ=	str_msg.o str32.o str64.o
49
50SYM_LIB=	sym.so
51SYM_OBJ=	sym_msg.o sym32.o sym64.o
52
53SYMINFO_LIB=	syminfo.so
54SYMINFO_OBJ=	syminfo_msg.o syminfo32.o syminfo64.o
55
56ELFEDITLIBS=	$(CAP_LIB) $(DYN_LIB) $(EHDR_LIB) $(PHDR_LIB) \
57		$(SHDR_LIB) $(STR_LIB) $(SYM_LIB) $(SYMINFO_LIB)
58
59PICDIR=		pics
60
61CAP_PICS=	$(CAP_OBJ:%.o=$(PICDIR)/%.o)
62DYN_PICS=	$(DYN_OBJ:%.o=$(PICDIR)/%.o)
63EHDR_PICS=	$(EHDR_OBJ:%.o=$(PICDIR)/%.o)
64PHDR_PICS=	$(PHDR_OBJ:%.o=$(PICDIR)/%.o)
65SHDR_PICS=	$(SHDR_OBJ:%.o=$(PICDIR)/%.o)
66STR_PICS=	$(STR_OBJ:%.o=$(PICDIR)/%.o)
67SYM_PICS=	$(SYM_OBJ:%.o=$(PICDIR)/%.o)
68SYMINFO_PICS=	$(SYMINFO_OBJ:%.o=$(PICDIR)/%.o)
69
70LDLIBS +=	$(ELFLIBDIR) -lelf $(LDDBGLIBDIR) -llddbg \
71		$(CONVLIBDIR) -lconv -lc
72
73$(CAP_LIB):=		PICS = $(CAP_PICS)
74$(DYN_LIB):=		PICS = $(DYN_PICS)
75$(EHDR_LIB):=		PICS = $(EHDR_PICS)
76$(PHDR_LIB):=		PICS = $(PHDR_PICS)
77$(SHDR_LIB):=		PICS = $(SHDR_PICS)
78$(STR_LIB):=		PICS = $(STR_PICS)
79$(SYM_LIB):=		PICS = $(SYM_PICS)
80$(SYMINFO_LIB):=	PICS = $(SYMINFO_PICS)
81
82$(CAP_LIB):=		SONAME = $(CAP_LIB)
83$(DYN_LIB):=		SONAME = $(DYN_LIB)
84$(EHDR_LIB):=		SONAME = $(EHDR_LIB)
85$(PHDR_LIB):=		SONAME = $(PHDR_LIB)
86$(SHDR_LIB):=		SONAME = $(SHDR_LIB)
87$(STR_LIB):=		SONAME = $(STR_LIB)
88$(SYM_LIB):=		SONAME = $(SYM_LIB)
89$(SYMINFO_LIB):=	SONAME = $(SYMINFO_LIB)
90
91# All the modules use a shared mapfile
92MAPFILES = ../common/mapfile-vers
93
94CPPFLAGS +=	-I../../../include -I../../../include/$(MACH) \
95		-I$(SRC)/lib/libc/inc  -D_REENTRANT
96LLDFLAGS =	'-R$$ORIGIN/../../../lib'
97LLDFLAGS64 =	'-R$$ORIGIN/../../../../lib/$(MACH64)'
98LDFLAGS +=	$(LLDFLAGS)
99DYNFLAGS +=	$(VERSREF)
100
101CERRWARN +=	-_gcc=-Wno-switch
102CERRWARN +=	$(CNOWARN_UNINIT)
103
104BLTDEFS =	$(ELFEDITLIBS:%.so=%_msg.h)
105BLTDATA =	$(ELFEDITLIBS:%.so=%_msg.c)
106BLTFILES =	$(BLTDEFS) $(BLTDATA)
107
108CLEANFILES +=	$(BLTFILES) $(PICDIR)/*
109CLOBBERFILES +=	$(ELFEDITLIBS)
110
111ROOTELFEDITDIR=		$(ROOT)/usr/lib/elfedit
112ROOTELFEDITDIR64=	$(ROOT)/usr/lib/elfedit/$(MACH64)
113ROOTELFEDITLIBS=	$(ROOTELFEDITDIR)/$(MTARG)$(CAP_LIB) \
114			$(ROOTELFEDITDIR)/$(MTARG)$(DYN_LIB) \
115			$(ROOTELFEDITDIR)/$(MTARG)$(EHDR_LIB) \
116			$(ROOTELFEDITDIR)/$(MTARG)$(PHDR_LIB) \
117			$(ROOTELFEDITDIR)/$(MTARG)$(SHDR_LIB) \
118			$(ROOTELFEDITDIR)/$(MTARG)$(STR_LIB) \
119			$(ROOTELFEDITDIR)/$(MTARG)$(SYM_LIB) \
120			$(ROOTELFEDITDIR)/$(MTARG)$(SYMINFO_LIB)
121
122
123FILEMODE=	0755
124
125.PARALLEL:	$(ELFEDITLIBS)
126