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 2007 Sun Microsystems, Inc. All rights reserved. 23# Use is subject to license terms. 24# 25# Copyright (c) 2019, Joyent, Inc. 26 27# 28# The build process for libsaveargs is sightly different from that used by other 29# libraries, because libsaveargs must be built in two flavors - as a standalone 30# for use by kmdb and as a normal library. We use $(CURTYPE) to indicate the 31# current flavor being built. 32# 33 34LIBRARY= libsaveargs.a 35STANDLIBRARY= libstandsaveargs.so 36VERS= .1 37 38# By default, we build the shared library. Construction of the standalone 39# is specifically requested by architecture-specific Makefiles. 40TYPES= library 41CURTYPE= library 42 43COMDIR= $(SRC)/lib/libsaveargs/common 44 45OBJECTS_common_amd64 = saveargs.o 46SRCS_common_amd64 = $(OBJECTS_common_amd64:%.o=../amd64/%.c) 47 48OBJECTS= $(OBJECTS_common_$(MACH)) $(OBJECTS_common_$(MACH64)) $(OBJECTS_common_common) 49 50include $(SRC)/lib/Makefile.lib 51 52SRCS= $(SRCS_common_$(MACH)) $(SRCS_common_$(MACH64)) $(SRC_common_common) 53 54# 55# Used to verify that the standalone doesn't have any unexpected external 56# dependencies. 57# 58LINKTEST_OBJ = objs/linktest_stand.o 59 60CLOBBERFILES_standalone = $(LINKTEST_OBJ) 61CLOBBERFILES += $(CLOBBERFILES_$(CURTYPE)) 62 63# 64# The standalone environment currently does not support the stack 65# protector. 66# 67$(STANDLIBRARY) := STACKPROTECT = none 68 69LIBS_standalone = $(STANDLIBRARY) 70LIBS_library = $(DYNLIB) 71LIBS = $(LIBS_$(CURTYPE)) 72 73MAPFILES = $(COMDIR)/mapfile-vers 74 75LDLIBS += -lc -ldisasm 76 77LDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -dy -r 78LDFLAGS = $(LDFLAGS_$(CURTYPE)) 79 80ASFLAGS_standalone = -DDIS_STANDALONE 81ASFLAGS_library = 82ASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM 83 84 85# We want the thread-specific errno in the library, but we don't want it in 86# the standalone. $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS), 87# in order to enable this feature. Conveniently, -D_REENTRANT does the same 88# thing. As such, we null out $(DTS_ERRNO) to ensure that the standalone 89# doesn't get it. 90DTS_ERRNO= 91 92CPPFLAGS_standalone = -DDIS_STANDALONE 93CPPFLAGS_library = -D_REENTRANT 94CPPFLAGS += -I$(COMDIR) $(CPPFLAGS_$(CURTYPE)) 95 96CFLAGS_standalone = $(STAND_FLAGS_32) 97CFLAGS_common = 98CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common) 99 100CFLAGS64_standalone = $(STAND_FLAGS_64) 101CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common) 102 103DYNFLAGS += $(ZINTERPOSE) 104 105.KEEP_STATE: 106