1 #
   2 # Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20 # CA 95054 USA or visit www.sun.com if you need additional information or
  21 # have any questions.
  22 #  
  23 #
  24 
  25 
  26 # Targets are:
  27 #   32bit:  Build the 32 bit version in ./32bit
  28 #   64bit:  Build the 64 bit version in ./64bit
  29 #   helloWorld:  Build the helloWorld test program
  30 #   all:    Build all of the above.  This is the default.
  31 #
  32 # NOTE: This makefile uses IOBuf.cpp, IOBuf.hpp, Buffer.cpp, and
  33 #           Buffer.hpp from the src/os/win32/agent directory.
  34 
  35 .PHONY: 32bit 64bit
  36 
  37 ARCH_ORIG = $(shell uname -p)
  38 
  39 # C++    := /java/devtools/$(ARCH_ORIG)/SUNWspro/SC6.1/bin/CC
  40 
  41 C++    := CC
  42 RM     := /usr/bin/rm
  43 MKDIRS := /usr/bin/mkdir -p
  44 
  45 
  46 WIN32_DIR := ../../win32
  47 ARCH     := $(subst i386,i486,$(ARCH_ORIG))
  48 # INCLUDES := -I/net/sparcworks.eng/export/set/sparcworks5/dbx_62_intg/dev/src/dbx -I$(WIN32_DIR)
  49 INCLUDES := -I. -I$(WIN32_DIR)
  50 CFLAGS_32bit := -xarch=v8
  51 CFLAGS_64bit := -xarch=v9
  52 CFLAGS   := -PIC -xO3 $(INCLUDES)
  53 LIBS     := -lsocket -lnsl -lrtld_db
  54 LDFLAGS  := -G
  55 
  56 ifneq "$(ARCH)" "i486"
  57     CFLAGS += $(CFLAGS_$(VERSION))
  58     LDFLAGS += $(CFLAGS_$(VERSION))
  59 endif
  60 
  61 # We use IOBuf.hpp, IOBuf.cpp, Buffer.hpp, and Buffer.cpp from the win32 dir.
  62 vpath %.cpp .:$(WIN32_DIR)
  63 vpath %.hpp .:$(WIN32_DIR)
  64 
  65 OBJS = $(VERSION)/svc_agent_dbx.o $(VERSION)/IOBuf.o $(VERSION)/Buffer.o
  66 
  67 
  68 
  69 # The default is to make both 32 bit and 64 bit versions.
  70 all:: 32bit 64bit
  71 
  72 32bit 64bit:: 
  73         $(MKDIRS) $@
  74         $(MAKE) $@/libsvc_agent_dbx.so  helloWorld VERSION=$@
  75 
  76 $(VERSION)/IOBuf.o: IOBuf.hpp
  77 $(VERSION)/Buffer.o: Buffer.hpp
  78 $(VERSION)/svc_agent_dbx.o: svc_agent_dbx.hpp
  79 
  80 $(VERSION)/%.o: %.cpp
  81         $(C++) $(CFLAGS) -c $< -o $@
  82 
  83 $(VERSION)/libsvc_agent_dbx.so:: $(OBJS)
  84         $(C++) $(LDFLAGS) -o $(VERSION)/libsvc_agent_dbx.so $(OBJS) $(LIBS)
  85 
  86 # Would be nice to move this into a shared directory
  87 helloWorld:: helloWorld.cpp
  88         $(C++) -g $< -o $@
  89 
  90 clean::
  91         $(RM) -rf 32bit 64bit *.o helloWorld