Well, this issue is (mostly) resolved. I had to hack together this makefile to 
get things to work:


##############################################################################
# On alpha/bravo/charlie, use gmake.
# On ubuntu use make.

# Set to 1 to enable debugging
debug = 1
# Set to 1 to enable optimization
release = 0

### App files ################################################################
bins = simple
objs = $(bins:%=%.o)
libs =

### Paths ####################################################################
ifeq ($(OSTYPE),solaris)
  empty =
  space = $(empty) $(empty)
  isalist = $(shell isalist)
  libpaths = \
    $(isalist:%=/opt/csw/gcc4/lib/%) \
    $(isalist:%=/opt/csw/lib/%)
  paths = \
    /opt/csw/gcc4/bin \
    /opt/csw/bin \
    /usr/ccs/bin \
    /usr/bin
  export LD_LIBRARY_PATH := $(subst $(space),:,$(libpaths))
  export PATH := $(subst $(space),:,$(paths))
endif

### Tools ####################################################################
cc  = gcc
cxx = g++
ld  = $(shell $(cc) -print-prog-name=ld)

### Flags ####################################################################
cflags  = -Wall -march=native
ldflags =
ifeq ($(OSTYPE),solaris)
  cflags  += -m64
  ldflags += -R$$LD_LIBRARY_PATH
endif
ifeq ($(debug), 1)
  cflags += -g
endif
ifeq ($(release), 1)
  cflags += -O3
  ifeq ($(debug), 0)
    cflags += -s
  endif
endif
cxxflags = $(cflags)

### Targets ##################################################################
all: $(bins)
$(bins): %: %.cpp
        $(cxx) $(cxxflags) $< $(ldflags:%=-Xlinker %) $(libs) -o $@
        @file $@
clean:
        rm *.o *~ $(bins)
envdebug:
        env
        which gcc
        which g++
        which ld
-- 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to