#
# $Id: Makefile,v 1.14 2008/02/20 08:31:08 jaw Exp $
#

# Define any symbols needed to invoke configuration changes in make.config

# none

# Include standard make configuration stuff that applies to everything
# in the paradyn tree.

include ../../make.config 

ifndef STATIC_TARGET
    STATIC_TARGET = libdyninstAPI_RT.a
endif

# Now make any necessary architecture specific changes to variables:

NATIVE_CC = cc
ifneq (,$(findstring WorkShop,$(shell $(NATIVE_CC) -V 2>&1)))
USES_NATIVE_CC = true
endif
ifneq (,$(findstring Sun C,$(shell $(NATIVE_CC) -V 2>&1)))
USES_NATIVE_CC = true
endif

# if we want to produce a shared object...

CFLAGS          += -I. -I../..
ifdef USES_NATIVE_CC
CC		= $(NATIVE_CC) 
LD		= $(NATIVE_CC)
# OVERRIDE CFLAGS (we need to strip -O2)
CFLAGS		= $(IFLAGS) $(UNIFIED_DEF) $(COMMON_WARNINGS)
STATIC_CFLAGS   := $(CFLAGS) -DDYNINST_RT_STATIC_LIB -D_NATIVESO_ -xarch=v8plus
CFLAGS          += -Kpic -D_NATIVESO_  -xarch=v8plus 
LDFLAGS         += -ldl  -lsocket -dy -G -z text -z initarray=libdyninstAPI_RT_init
STATIC_ASFLAGS  := $(ASFLAGS)
ASFLAGS		+= -K PIC
else
CC              = $(GCC)
LD              = $(GCC)
STATIC_CFLAGS   := $(CFLAGS) -DDYNINST_RT_STATIC_LIB
CFLAGS          += -fpic
LDFLAGS		= -ldl   -lsocket -shared -nostdlib -lgcc -z initarray=libdyninstAPI_RT_init
#ccw 19 nov 2001
endif

#CFLAGS += -DDEBUG_PRINT_RT      # enable debug/trace messages from library

SRCS		+= ../src/RTposix.c \
		   ../src/RTsolaris.c \
		   ../src/RTheap.c \
		   ../src/RTheap-solaris.c \
		   ../src/RTheap-svr4.c \
			../src/RTthread.c \
			../src/RTthread-sparc-asm.S
#			../src/RTmutatedBinary.c \
#			../src/RTmutatedBinary_ELF.c \


# Include the module-specific Makefile, which defines everything about
# the module that is common across architectures.

include ../make.module.tmpl

# Include the "standard program template".  This defines all the
# common targets like "clean", "install", etc.

include ../../make.library.tmpl


#	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o RTthread-sparc-asm.o ../src/RTthread-sparc-asm.S

RTthread-sparc-asm.o: ../src/RTthread-sparc-asm.S
	$(CC) $(CFLAGS) -c -o RTthread-sparc-asm.o ../src/RTthread-sparc-asm.S

RTthread-sparc-asm_nopic.o: ../src/RTthread-sparc-asm.S
	$(CC) $(STATIC_CFLAGS) -c -o RTthread-sparc-asm_nopic.o $<
