2 # Makefile for test programs on Sparc Solaris 2.4
4 # $Id: Makefile,v 1.30 2005/02/10 20:39:16 jaw Exp $
7 # Define any symbols needed to invoke configuration changes in make.config
10 NO_IMPLICIT_TEMPLATES = true
14 USES_MUTATEE_LIBS = true
17 MUTATEE_TEST9_LIBS_LIST = libInstMe.so libLoadMe.so
18 MUTATEE_TEST9_LIBS = -L. -lInstMe
21 # VG(12/02/01): Using stabs for dbx because gdb 5.0 cannot continue a
22 # mutatee stopped by a dyninst mutator (on our 24-way SunFire at
23 # least). BTW, -g appeard an awful number of times in this file...
25 # This is used by make.config for ALL compilers (unfortunately)
26 # It is really only for gcc
29 # Include standard make configuration stuff that applies to everything
30 # in the paradyn tree.
31 include $(TO_CORE)/make.config
33 # This is used in this file for the native compiler(s)
34 NATIVE_DEBUG_FLAG = -g -xs
36 # Now make any necessary architecture specific changes to variables:
38 #CXXFLAGS += -gstabs -DUSES_DYNAMIC_INF_HEAP
39 #CFLAGS += -gstabs -DUSES_DYNAMIC_INF_HEAP
41 # FIXME: This is a bad place for the debug flag...
42 SYSLIBS += $(DEBUG_FLAG) -lelf -lstdc++ -lsocket
44 MUTATEE_FFLAGS += -Dsparc_sun_solaris2_4 $(NATIVE_DEBUG_FLAG)
46 #the _ALT PATH is in case the gcc library can't be found in the first path
48 LIBGCCLOC = /p/paradyn/packages/gcc-2.95.3/lib/gcc-lib/PLATFORM/2.95.3
49 # Allowing _ALT path to be changed in make.config.local
50 # The default _ALT path is for UMD Solaris 8 machines.
51 LIBGCCLOC_ALT ?= /usr/local/gcc-2.95.3-cv/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3
53 LIBGCCLOC = /s/gcc-3.2.2/lib/gcc-lib/sparc-sun-solaris2.8/3.2.2
54 LIBGCCLOC_ALT ?= /usr/local/gcc-2.95.3-cv/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3
56 MUTATEE_FLINKFLAGS += -L$(LIBGCCLOC) -L$(LIBGCCLOC_ALT) -ldl -lgcc
61 # define these only if not invoked recursively, otherwise they're set
64 export NATIVE_CXX = CC
65 export NATIVE_FC = f90
67 # skip the builds with native (WorkShop) compilers if they're not available
68 ifeq (,$(findstring Forte,$(shell $(NATIVE_CC) -V 2>&1)))
69 ifeq (,$(findstring WorkShop,$(shell $(NATIVE_CC) -V 2>&1)))
70 ifeq (,$(findstring Sun C ,$(shell $(NATIVE_CC) -V 2>&1)))
77 # One may have cc without CC...
78 ifeq (,$(findstring Forte,$(shell $(NATIVE_CXX) -V 2>&1)))
79 ifeq (,$(findstring WorkShop,$(shell $(NATIVE_CXX) -V 2>&1)))
80 ifeq (,$(findstring Sun C++,$(shell $(NATIVE_CXX) -V 2>&1)))
87 # One may have cc without f90...
88 ifeq (,$(findstring Forte,$(shell $(NATIVE_FC) -V 2>&1)))
89 ifeq (,$(findstring WorkShop,$(shell $(NATIVE_FC) -V 2>&1)))
90 ifeq (,$(findstring Sun Fortran,$(shell $(NATIVE_FC) -V 2>&1)))
99 TEST6_ASFLAGS = -P -xarch=v8plus
102 # Include the module-specific Makefile, which defines everything about
103 # the module that is common across architectures.
105 include ../make.module.tmpl
109 COMPILERT = $(shell $(MUTATEE_CC) -v 2>&1 | grep version | head -1)
111 ifeq ($(MUTATEE_CC),$(NATIVE_CC))
112 COMPILERT = $(shell $(MUTATEE_CC) -V 2>&1 | head -1)
113 MUTATEE_CFLAGS = $(UNIFIED_DEF) $(NATIVE_DEBUG_FLAG) -Wa,-xarch=v8plus
115 MUTATEE_CFLAGS = $(MODCFLAGS) $(DEBUG_FLAG)
118 ifeq ($(MUTATEE_CC),$(NATIVE_CXX))
119 # using "-instances=static" or "-instances=global" flag allows the template
120 # instantiations being in the current object file and gives them static and
121 # global linkage respectively
123 # VG(12/02/01): Overriding these to put the right debug flag
124 MUTATEE_CFLAGS = $(UNIFIED_DEF) $(NATIVE_DEBUG_FLAG) -instances=static
126 COMPILERT = $(shell $(MUTATEE_CC) -V 2>&1 | head -1)
130 BLANK:=$(EMPTY) $(EMPTY)
133 COMPILER1 = $(subst $(BLANK),_,$(COMPILERT))
134 COMPILER2 = $(subst $(LPAREN),_,$(COMPILER1))
135 COMPILER = $(subst $(RPAREN),_,$(COMPILER2))
136 MUTATEE_CFLAGS += -DCOMPILER='"$(COMPILER)"'
138 ### C/C++ mutatee target rule ###
139 # MUTATEE_CC gets set even for Fortran targets. The only way
140 # to check for C/C++ mutatee is to look at MUTATEE_FC.
143 $(TARGET2): $(MUTATEE_SRC)
144 $(MUTATEE_CC) $(MUTATEE_CFLAGS) $(MUTATEE_SRC) $(MUTATEE_OBJS) -o $@ $(MUTLIBS)
147 ### Fortran mutatee targets rules ###
148 # First check if we have found a native Fortran compiler.
149 # Then check if MUTATEE_FC matches it. For C/C++ targets
150 # MUTATEE_FC is undefined. NATIVE_FC may also be undefined
151 # if no Fortran compiler is found; the first check is useful.
154 ifeq ($(NATIVE_FC),$(MUTATEE_FC))
158 # FORTRAN_BASE = test1.mutateeFort, etc.
159 FORTRAN_BASE = $(TARGET2:_$(NATIVE_FC)=Fort)
161 # VG: Recompile the common stuff with the same C compiler (gcc) as the Fortran
162 # test C code. This prevents the very nasty situation where a C++ object file
163 # produced by another compiler (CC) is fed to the linker (which doesn't take it).
164 $(TARGET2): $(FORTRAN_BASE)_$(NATIVE_FC).o $(FORTRAN_BASE)C_$(NATIVE_FC).o
165 $(MUTATEE_CC) $(MUTATEE_CFLAGS) -W -Wall -c -o test1.mutateeCommon.o ../src/test1.mutateeCommon.c
166 $(MUTATEE_CC) $(MUTATEE_CFLAGS) -W -Wall -c -o mutatee_util.o ../src/mutatee_util.c
167 $(NATIVE_FC) $(MUTATEE_FFLAGS) ../src/$(FORTRAN_BASE).F $(FORTRAN_BASE)C_$(NATIVE_FC).o test1.mutateeCommon.o mutatee_util.o $(MUTATEE_FLINKFLAGS) -o $(TARGET2)
169 $(FORTRAN_BASE)_$(NATIVE_FC).o:
170 $(NATIVE_FC) $(MUTATEE_FFLAGS) -c -o $(FORTRAN_BASE)_$(NATIVE_FC).o ../src/$(FORTRAN_BASE).F
172 $(FORTRAN_BASE)C_$(NATIVE_FC).o:
173 $(MUTATEE_CC) $(MUTATEE_CFLAGS) -fno-implicit-templates -W -Wall $(FORT_SQGL_FLAG) -DFortran -c -o $(FORTRAN_BASE)C_$(NATIVE_FC).o ../src/$(FORTRAN_BASE)C.c
178 ifeq (test1,$(findstring test1,$(TARGET2)))
179 MUTATEE_SRC += ../src/call35_1_sparc_solaris.s
183 #MODCC = purecov -best-effort g++
186 $(CC) $(PICOP) -c ../src/libtestA.c
189 $(CC) $(PICOP) -c ../src/libtestB.c
191 libtestA.so: libtestA.o
192 $(CC) $(SHAREDOP) -o libtestA.so libtestA.o
194 libtestB.so: libtestB.o
195 $(CC) $(SHAREDOP) -o libtestB.so libtestB.o
198 libLoadMe.o: libLoadMe.c
199 $(CC) $(PICOP) -c ../src/libLoadMe.c
201 libLoadMe.so: libLoadMe.o
202 $(CC) $(SHAREDOP) -z initarray=loadMe_init libLoadMe.o -o libLoadMe.so
204 libInstMe.o: libInstMe.c
205 $(CC) $(PICOP) -c ../src/libInstMe.c
207 libInstMe.so: libInstMe.o
208 $(CC) $(SHAREDOP) libInstMe.o -o libInstMe.so
213 # Include the "standard program template". This defines all the
214 # common targets like "clean", "install", etc.
216 include $(TO_CORE)/make.program.tmpl