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.
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.
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]
22 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
29 ASOBJS = sn1_crt.o sn1_handler.o sn1_runexe.o
30 OFFSETS_SRC = ../common/offsets.in
32 OBJECTS = $(COBJS) $(ASOBJS)
33 CLOBBERFILES += $(OFFSETS_H)
35 include ../../Makefile.sn1
36 include $(SRC)/lib/Makefile.lib
42 CSRCS = $(COBJS:%o=../common/%c)
43 ASSRCS = $(ASOBJS:%o=$(ISASRCDIR)/%s)
44 SRCS = $(CSRCS) $(ASSRCS)
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
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.
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().
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).
78 NATIVE_DIR = /.SUNWnative
79 CPPFLAGS += -D_REENTRANT -U_ASM -I. -I../sys -I$(UTSBASE)/common/brand/sn1
80 CFLAGS += $(CCVERBOSE)
81 ASFLAGS = -P $(ASFLAGS_$(CURTYPE)) -D_ASM -I. -I../sys
82 DYNFLAGS += $(DYNFLAGS_$(CLASS))
83 DYNFLAGS += $(BLOCAL) $(ZNOVERSION) -Wl,-e_start
84 #DYNFLAGS += -R$(NATIVE_DIR)/lib -R$(NATIVE_DIR)/usr/lib
85 LDLIBS += -lc -lmapmalloc
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.)
97 $(OBJECTS:%=pics/%): $(OFFSETS_H)
98 $(OFFSETS_H): $(OFFSETS_SRC)
99 $(OFFSETS_CREATE) $(CTF_FLAGS) < $(OFFSETS_SRC) >$@
101 pics/%.o: $(ISASRCDIR)/%.s
102 $(COMPILE.s) -o $@ $<
105 include $(SRC)/lib/Makefile.targ