1#
2# This Source Code Form is subject to the terms of the Mozilla Public
3# License, v. 2.0. If a copy of the MPL was not distributed with this
4# file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
6
7MOD_DEPTH	= ../../../..
8topsrcdir	= @top_srcdir@
9srcdir		= @srcdir@
10VPATH		= @srcdir@
11
12include $(MOD_DEPTH)/config/autoconf.mk
13
14include $(topsrcdir)/config/config.mk
15
16CSRCS =          \
17	unix.c    \
18	unix_errors.c    \
19	uxproces.c \
20	uxrng.c \
21	uxshm.c \
22	uxwrap.c \
23	$(NULL)
24
25ifneq ($(USE_PTHREADS),1)
26CSRCS += uxpoll.c
27endif
28
29ifeq ($(PTHREADS_USER),1)
30CSRCS += pthreads_user.c
31endif
32
33CSRCS += $(PR_MD_CSRCS)
34ASFILES += $(PR_MD_ASFILES)
35
36TARGETS = $(OBJS)
37
38ifeq ($(OS_ARCH),SunOS)
39	ifeq ($(CPU_ARCH),sparc)
40		ifdef USE_64
41			ULTRASPARC_ASFILES = os_SunOS_sparcv9.s
42			ULTRASPARC_ASOBJS = $(addprefix $(OBJDIR)/,$(ULTRASPARC_ASFILES:.s=.$(OBJ_SUFFIX)))
43		else
44			LIBRARY_NAME = $(ULTRASPARC_LIBRARY)
45			LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
46			ULTRASPARC_ASFILES = os_SunOS_ultrasparc.s
47			ULTRASPARC_ASOBJS = $(addprefix $(OBJDIR)/,$(ULTRASPARC_ASFILES:.s=.$(OBJ_SUFFIX)))
48			TARGETS		+= $(ULTRASPARC_ASOBJS) $(SHARED_LIBRARY)
49			RELEASE_LIBS = $(SHARED_LIBRARY)
50			RELEASE_LIBS_DEST = $(RELEASE_LIB_DIR)/cpu/sparcv8plus
51			lib_subdir = cpu/sparcv8plus
52		endif
53	endif
54endif
55
56INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
57
58DEFINES	+= -D_NSPR_BUILD_
59
60include $(topsrcdir)/config/rules.mk
61
62export:: $(TARGETS)
63
64ifeq ($(OS_ARCH),SunOS)
65ifeq ($(CPU_ARCH),sparc)
66
67ifdef USE_64
68$(ULTRASPARC_ASOBJS): $(ULTRASPARC_ASFILES)
69	/usr/ccs/bin/as -o $@ -K PIC -P -D_ASM -D__STDC__=0 -xarch=v9 $<
70else
71$(SHARED_LIBRARY): $(ULTRASPARC_ASOBJS)
72	$(LD) -G -z text -z endfiltee -o $@ $(ULTRASPARC_ASOBJS)
73	$(INSTALL) -m 444 $@ $(dist_libdir)/cpu/sparcv8plus
74	$(INSTALL) -m 444 $@ $(dist_bindir)/cpu/sparcv8plus
75#
76# The -f $(ORIGIN)/... linker flag uses the real file, after symbolic links
77# are resolved, as the origin.  If NSDISTMODE is not "copy", libnspr4.so
78# will be installed as a symbolic link in $(dist_libdir), pointing to the
79# real libnspr4.so file in pr/src.  Therefore we need to install an
80# additional copy of libnspr_flt4.so in pr/src/cpu/sparcv8plus.
81#
82ifneq ($(NSDISTMODE),copy)
83	$(INSTALL) -m 444 $@ ../../cpu/sparcv8plus
84endif
85
86ifneq ($(NSDISTMODE),copy)
87clobber realclean clobber_all distclean::
88	rm -rf ../../cpu
89endif
90
91$(ULTRASPARC_ASOBJS): $(ULTRASPARC_ASFILES)
92	/usr/ccs/bin/as -o $@ -K PIC -P -D_ASM -D__STDC__=0 -xarch=v8plus $<
93
94clean::
95	rm -rf $(ULTRASPARC_ASOBJS)
96endif
97
98endif
99endif
100