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 2008 Sun Microsystems, Inc. All rights reserved. 23# Use is subject to license terms. 24# 25 26LIBRARY = sn1_brand.a 27VERS = .1 28COBJS = sn1_brand.o 29ASOBJS = sn1_crt.o sn1_handler.o sn1_runexe.o 30OFFSETS_SRC = ../common/offsets.in 31OFFSETS_H = assym.h 32OBJECTS = $(COBJS) $(ASOBJS) 33CLOBBERFILES += $(OFFSETS_H) 34 35include ../../Makefile.sn1 36include $(SRC)/lib/Makefile.lib 37 38SRCDIR = ../common 39UTSBASE = $(SRC)/uts 40 41LIBS = $(DYNLIB) 42CSRCS = $(COBJS:%o=../common/%c) 43ASSRCS = $(ASOBJS:%o=$(ISASRCDIR)/%s) 44SRCS = $(CSRCS) $(ASSRCS) 45 46# 47# Ugh, this is a gross hack. Our assembly routines uses lots of defines 48# to simplify variable access. All these defines work fine for amd64 49# compiles because when compiling for amd64 we use the GNU assembler, 50# gas. For 32-bit code we use the Sun assembler, as. Unfortunatly 51# as does not handle certian constructs that gas does. So rather than 52# make our code less readable, we'll just use gas to compile our 32-bit 53# code as well. 54# 55i386_AS = $(amd64_AS) 56 57# 58# Note that the architecture specific makefiles MUST update DYNFLAGS to 59# explicily specify an interpreter for the brand emulation library. 60# Normally this would be the native linker, /.SUNWnative/usr/lib/ld.so.1 61# or /.SUNWnative/usr/lib/64/ld.so.1. 62# 63# Note that we make sure to link our brand emulation library 64# libmapmalloc. This is required because in most cases there will be two 65# copies of libc in the same process and we don't want them to fight over 66# the heap. So for our brand library we link against libmapmalloc so that 67# if we (our or copy of libc) try to allocate any memory it will be done 68# via mmap() instead of brk(). 69# 70# XXX: Note that we also set the runtime path for the emulation library to 71# point into /.SUNWnative/. This ensures that our brand library get's the 72# native versions of any libraries it needs. Unfortunatly this is a total 73# hack since it doesn't work for suid binaries. What we really need to do 74# is enhance the linker so that when it's running on a brand linkmap it 75# looks for all libraries in the brands "native" directory (for both 76# regular and suid binaries). 77# 78NATIVE_DIR = /.SUNWnative 79CPPFLAGS += -D_REENTRANT -U_ASM -I. -I../sys -I$(UTSBASE)/common/brand/sn1 80CFLAGS += $(CCVERBOSE) 81ASFLAGS = -P $(ASFLAGS_$(CURTYPE)) -D_ASM -I. -I../sys 82DYNFLAGS += $(DYNFLAGS_$(CLASS)) 83DYNFLAGS += $(BLOCAL) $(ZNOVERSION) -Wl,-e_start 84#DYNFLAGS += -R$(NATIVE_DIR)/lib -R$(NATIVE_DIR)/usr/lib 85LDLIBS += -lc -lmapmalloc 86 87.KEEP_STATE: 88 89all: $(LIBS) 90 91lint: lintcheck 92 93# 94# build the offset header before trying to compile any files. (it's included 95# by sn1_misc.h, so it's needed for all objects, not just assembly ones.) 96# 97$(OBJECTS:%=pics/%): $(OFFSETS_H) 98$(OFFSETS_H): $(OFFSETS_SRC) 99 $(OFFSETS_CREATE) $(CTF_FLAGS) < $(OFFSETS_SRC) >$@ 100 101pics/%.o: $(ISASRCDIR)/%.s 102 $(COMPILE.s) -o $@ $< 103 $(POST_PROCESS_O) 104 105include $(SRC)/lib/Makefile.targ 106