#

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

# XXX get rid of these:

#INSTANTIATE_TEMPLATES   = true
#DO_INLINE_ALL           = true
NO_OPT_FLAG = true
NO_IMPLICIT_TEMPLATES    = true
#AUTO_TEMPLATES 		 = true
OVERRIDE_INSTALL	= true

 DEBUG_FLAG = -g

ifdef COVERAGE
NO_OPT_FLAG		= true
endif

# AIX uses .a for library names...
TARGET	= libcommon.a

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

include ../../make.config 


ifdef COVERAGE
CXXFLAGS += -O0
endif

# Now make any necessary architecture specific changes to variables:

SRCS =		../../common/src/aixv41Kludges.C \
		../../common/src/timing-aix.C \
		../src/addrtranslate-aix.C

# Add preprocessor and special link information for G++
G_PTHREAD       = -pthread
# Commented out for daily wisc builds
#G_PTHREAD_LD	= -pthread


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

include ../make.module.tmpl

ifdef XLC_BUILD
  # should be building a static library in this case
  TARGET3_STATIC  = libdyninstAPI.a
  TARGET_INSTALL  = $(TARGET3_STATIC)
  AR = /usr/bin/ar
else
  # On AIX all symbols must be resolved at link time, even for a library.
  LDFLAGS += -Wl,-bbigtoc,-bexpall -lgcc -lc -lstdc++
  # Override default of gcc -- need g++ on AIX
  LD = $(GXX)
endif


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

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

# We wrap the native compiler demangle library. This doesn't appear to have a source file, but actually
# pulls code from <native compiler location>/lib/libdemangle.a. We use xlC because it knows the magic
# native compiler path. If xlC isn't installed then libdemangle.a won't be there either, and this silently
# (and harmlessly) fails.

libdemangle.so.1:
	-xlC -bnoobjreorder -bexpall -bnoentry -o libdemangle.so.1 -ldemangle -u functionName -u demangle -u kind -u varName -u text -lc 


#
# Install rule: install withOUT world-readable permissions
# 
install: install_generic libdemangle.so.1
	-$(CP) libdemangle.so.1 $(DEST)
	-chmod 750 $(DEST)/$(TARGET)
