Files
2022-12-13 12:44:04 +01:00

132 lines
5.1 KiB
Makefile
Executable File

# ******************************************************************************
# * Makefile.hpux : This is the platform specific Makefile for HPUX.
# *
# * Externals : This Makefile relies on the developer defining the
# * following external definitions...
# *
# * CDEV : The base directory of the CDEV distribution
# ******************************************************************************
TARGET = hpux
OS_MAJOR := $(shell uname -r | awk -F "." '{print $$2; exit}')
OS_MAJOR_NUM := $(shell awk 'BEGIN {VAL=$(OS_MAJOR); print VAL; exit; }')
OS_MINOR := $(shell uname -r | awk -F "." '{print $$3; exit}')
OS_MINOR_NUM := $(shell awk 'BEGIN {VAL=$(OS_MINOR); print VAL; exit; }')
OS_VERSION_DEF := -D_OS_MAJOR_=$(OS_MAJOR_NUM) -D_OS_MINOR_=$(OS_MINOR_NUM)
include $(CDEV)/extensions/cdevGenericServer/include/makeinclude/Makefile.common
include $(CDEV)/include/makeinclude/Makefile.archive
# ******************************************************************************
# * Due to a change in the operating system, the CXX compiler for HP-UX may
# * be different depending on which platform is used.
# ******************************************************************************
ifeq ($(OS_MAJOR), 09)
CXX := /usr/bin/CC
HP_FLAGS = -Aa -pta -ptb -D_SELECT_USES_INT_
endif
ifeq ($(OS_MAJOR).$(OS_MINOR), 10.10)
CXX := /opt/CC/bin/CC
HP_FLAGS = -Aa -pta -ptb -Dvolatile=""
NETLIBS = -lxti
endif
ifeq ($(OS_MAJOR).$(OS_MINOR), 10.20)
CXX := /opt/aCC/bin/aCC
HP_FLAGS = +W302,749,829
NETLIBS = -lxti
endif
# ******************************************************************************
# * Platform specific compile and link options.
# ******************************************************************************
# ******************************************************************************
# * Only specify the DEBUGFLAG if the DEBUG variable has been set.
# ******************************************************************************
ifdef DEBUG
DEBUGFLAG = -g
else
DEBUGFLAG = +O2
endif
CC = cc
CXXFLAGS = -z $(CXXEXTRA) $(CXXINCLUDES) $(CDEVINCLUDES) \
$(BASEINCLUDES) $(OS_VERSION_DEF) $(DEBUGFLAG) $(HP_FLAGS) -DSYSV
CFLAGS = -Aa $(CCEXTRA) $(CXXINCLUDES) $(CDEVINCLUDES) \
$(BASEINCLUDES) $(OS_VERSION_DEF) $(DEBUGFLAG) -DSYSV
LDFLAGS = -L$(CDEVLIB) -Wl,+s
AR = ar
ARFLAGS = ruv
RANLIB = true
DLD = $(CXX)
SOFLAGS = -b -Wl,+s
PIC = +z
SHARED_EXT = sl
OSLIBS = -L/lib -lm
# ******************************************************************************
# * These definitions define the names and locations of libraries that are
# * required by CDEV for a shared and archive applications. The developer
# * is required to add the list of service specific libraries.
# ******************************************************************************
ifeq ($(SHOBJ), NO)
CDEVLIBS = $(CDEVLIB)/libcdev.a $(ARCHIVELIBS)
else
CDEVLIBS = -L$(CDEVLIB) -lcdev
endif
# ******************************************************************************
# * Platform specific compile and link macros.
# ******************************************************************************
COMPILE.cc = $(QUIET)$(CXX_CMD_ECHO)rm -rf $@;\
mkdir -p $(@D);\
$(PURIFY) $(CXX) -c $(CXXFLAGS) $^ -o $@
COMPILE.cc.so = $(QUIET)$(CXX_CMD_ECHO)rm -rf $@;\
mkdir -p $(@D);\
$(PURIFY) $(CXX) -c $(CXXFLAGS) $(PIC) $^ -o $@
COMPILE.c = $(QUIET)$(CC_CMD_ECHO)rm -rf $@;\
mkdir -p $(@D);\
$(CC) -c $(CFLAGS) $^ -o $@
COMPILE.c.so = $(QUIET)$(CC_CMD_ECHO)rm -rf $@;\
mkdir -p $(@D);\
$(CC) -c $(CFLAGS) $(PIC) $^ -o $@
LINK.cc = $(QUIET)$(LINK_CMD_ECHO)rm -rf $@;\
mkdir -p $(@D);\
$(PURIFY) $(CXX) $(CXXFLAGS)
LINK.a = $(QUIET)$(AR_CMD_ECHO)rm -rf $@;\
mkdir -p $(@D);\
$(AR) $(ARFLAGS)
LINK.so = $(QUIET)$(SO_CMD_ECHO)rm -rf $@;\
mkdir -p $(@D);\
$(PURIFY) $(DLD) $(SOFLAGS)
# ******************************************************************************
# * This is the macro to build a shared object/library.... it requires the
# * following variables to be defined...
# *
# * SO_SRCS : Names of the component source files
# * SO_LIBS : Names of the dependent libraries
# * LIBS : All libraries necessary to compile the dummy application
# ******************************************************************************
SOBUILD = rm -f $@;\
mkdir -p $(@D);\
echo "=> Building shared object $(@F)";\
echo " => Instanciating templates for $(@F)";\
echo "int main() {return 0;}" >dummy.cc;\
$(CXX) -c $(CXXFLAGS) $(PIC) dummy.cc $(SO_SRCS) $(LDFLAGS) -ptr./pt$(@F) -ptr./ptrepository $(LIBS);\
rm -rf a.out dummy.*;\
if test -f ./pt$(@F)/*.o;\
then\
echo " => Linking $(@F) from objects and template objects";\
$(LINK.so) -o $@ $^ ./pt$(@F)/*.o $(SO_LIBS);\
else\
echo " => Linking $(@F) from objects";\
$(LINK.so) -o $@ $^ $(SO_LIBS);\
fi;\
rm -rf *.o ./pt$(@F)