#
# The following variables are passed to each Makefile:
#
# CDEV_LIB	the name of the cdev library file (usually libcdev.a)
# CXX		the name of C++ compiler (CC or g++)
# CXXFLAGS	the C++ compiler flags
# CC		the name of c compiler (cc or gcc)
# CFLAGS	the c compiler flags
# MAKELIB	the command and flags for building library
# RANLIB	"ranlib" = use ranlib, "true" = don't use ranlib
# XTRACXXFLAGS  extra c++ flags
# XTRACFLAGS    extra c flags
# OS_TYPE       SYSV or BSD
# LEX       	the command for lex
# YACC          the command for yacc
# TARGET        the name of target machine
# SHOBJ         building shared library or not. (SHOBJ = YES/NO)
# OBJDIR        tempary objects directory for library (../lib)
# LIBLIB        final library diretory (../../lib/$(TARGET))
# INCDIR        include directory for header file (../../include)
# BINDIR        binary directory for executables (../../bin/$(TARGET))

.suffix: .o .C .c .cc .i .so

# ******************************************************************************
# * This section was added in order to support the same version of cdev across 
# * multiple versions of an operating system.
# ******************************************************************************
OS         := $(shell uname -s)

# ******************************************************************************
# * Only define the DEBUGFLAG if DEBUG has been specified by the user.
# ******************************************************************************
ifdef DEBUG
	DEBUGFLAG = -g
else
	ifeq ($(OS), HP_UX)
		DEBUGFLAG = +O2
	else 
		ifeq ($(OS), Linux)
			DEBUGFLAG = -O2
		endif
	endif
endif

# ******************************************************************************
# * This is the compressed command echo mechanism
# ******************************************************************************
ifeq ("$(VERBOSE)", "")
	VERBOSE = NO
	MAKE := $(MAKE) -s VERBOSE=NO
endif
 
ifeq ("$(VERBOSE)", "NO")
	CXX_CMD_ECHO = @echo "   => $(CXX) -c $(<F) -o $(@F)"
	CC_CMD_ECHO  = @echo "   => $(CC) -c $(<F) -o $(@F)"
else
	CXX_CMD_ECHO = @echo "\c"
	CC_CMD_ECHO  = @echo "\c"
endif

# ******************************************************************************
# * On HP-UX, the major and minor versions are prefixed by a revision letter.
# * Additionally, the hyphen must be removed from hp-ux.
# ******************************************************************************
ifeq ($(OS), HP-UX)
	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; }')
endif

# ******************************************************************************
# * On AIX, the major and minor versions are placed in -v and -r respectively.
# ******************************************************************************
ifeq ($(OS), AIX)
	OS_MAJOR     := $(shell uname -v)
	OS_MAJOR_NUM := $(shell awk 'BEGIN {print $(OS_MAJOR); exit; }')
	OS_MINOR     := $(shell uname -r)
	OS_MINOR_NUM := $(shell awk 'BEGIN {print $(OS_MINOR); exit; }')
endif

# ******************************************************************************
# * 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)-$(OS_MAJOR), HP-UX-09)
	HPCXX := /usr/bin/CC
	HPCXX_SHLIB_PATH := -Wl,+s
endif

ifeq ($(OS)-$(OS_MAJOR), HP-UX-10)
	HPCXX := /opt/aCC/bin/aCC
	HPCXX_FLAGS := +W302,829
	HPCXX_SHLIB_PATH := -Wl,+s
endif

# ******************************************************************************
# * This is the version information that will be passed to the compiler.
# ******************************************************************************
CDEVVERSION         = 1.7.2

CXXINCLUDES = -I../collection -I../device -I../system -I../cdevIO -I../group \
	-I../directory -I../common -I../callback
CINCLUDES = -I../system

hpux:
	@$(MAKE) targets \
	"TARGET = hpux" \
	"OS_MAJOR = $(OS_MAJOR)" \
	"OS_MINOR = $(OS_MINOR)" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = hpux-$(OS_MAJOR).$(OS_MINOR)" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = $(HPCXX)" \
	"CXXFLAGS = $(HPCXX_FLAGS) $(CXXINCLUDES) $(DEBUGFLAG)" \
	"CC = cc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -Aa -D_HPUX_SOURCE" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar ruv" \
	"RANLIB = true" \
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/hpux-$(OS_MAJOR).$(OS_MINOR)" \
	"BINDIR = ../../bin/hpux-$(OS_MAJOR).$(OS_MINOR)" \
	"INCDIR = ../../include"

hpux-sl:
	@$(MAKE) targets \
	"TARGET = hpux" \
	"OS_MAJOR = $(OS_MAJOR)" \
	"OS_MINOR = $(OS_MINOR)" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = hpux-$(OS_MAJOR).$(OS_MINOR)" \
	"CDEV_LIB = libcdev.sl" \
	"SHOBJ = YES" \
	"CXX = $(HPCXX)" \
	"CXXFLAGS = $(HPCXX_FLAGS) $(CXXINCLUDES) $(DEBUGFLAG) +Z -DSHOBJ" \
	"CC = cc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -Aa +Z -DSHOBJ -D_HPUX_SOURCE" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = $(HPCXX) -b -o" \
	"RANLIB = true"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/hpux-$(OS_MAJOR).$(OS_MINOR)" \
	"BINDIR = ../../bin/hpux-$(OS_MAJOR).$(OS_MINOR)" \
	"INCDIR = ../../include"

hpux-cl:
	@$(MAKE) targets \
	"TARGET = hpux-cl" \
	"OS_MAJOR = $(OS_MAJOR)" \
	"OS_MINOR = $(OS_MINOR)" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = hpux-cl-$(OS_MAJOR).$(OS_MINOR)" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = /usr/csite4/CenterLine/bin/CC" \
	"CXXFLAGS = $(CXXINCLUDES) $(DEBUGFLAG) -D_CENTERLINE" \
	"CC = cc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -Aa -D_CENTERLINE -D_HPUX_SOURCE" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar ruv" \
	"RANLIB = true" \
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/hpux-cl-$(OS_MAJOR).$(OS_MINOR)" \
	"BINDIR = ../../bin/hpux-cl-$(OS_MAJOR).$(OS_MINOR)" \
	"INCDIR = ../../include"

hpux-cl-sl:
	@$(MAKE) targets \
	"TARGET = hpux-cl" \
	"OS_MAJOR = $(OS_MAJOR)" \
	"OS_MINOR = $(OS_MINOR)" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = hpux-cl-$(OS_MAJOR).$(OS_MINOR)" \
	"CDEV_LIB = libcdev.sl" \
	"SHOBJ = YES" \
	"CXX = /usr/csite4/CenterLine/bin/CC" \
	"CXXFLAGS = $(CXXINCLUDES) $(DEBUGFLAG) -ec +Z -D_CENTERLINE -DSHOBJ" \
	"CC = cc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -Aa +Z -D_CENTERLINE -DSHOBJ -D_HPUX_SOURCE" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ld -b -o" \
	"RANLIB = true"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/hpux-cl-$(OS_MAJOR).$(OS_MINOR)" \
	"BINDIR = ../../bin/hpux-cl-$(OS_MAJOR).$(OS_MINOR)" \
	"INCDIR = ../../include"

irix5:
	@$(MAKE) targets \
	"TARGET = irix" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = irix" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = CC" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp $(DEBUGFLAG)" \
	"CC = cc" \
	"CFLAGS = $(CINCLUDES) -I../regexp $(DEBUGFLAG)" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar ruv" \
	"RANLIB = true" \
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/irix" \
	"BINDIR = ../../bin/irix" \
	"INCDIR = ../../include"

irix5-sl:
	@$(MAKE) targets \
	"TARGET = irix" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = irix" \
	"CDEV_LIB = libcdev.so" \
	"SHOBJ = YES" \
	"CXX = CC" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp $(DEBUGFLAG) -DSHOBJ -DSHM" \
	"CC = cc" \
	"CFLAGS = $(CINCLUDES) -I../regexp $(DEBUGFLAG) -DSHOBJ -DSHM" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ld -shared -all -o" \
	"RANLIB = true" \
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/irix" \
	"BINDIR = ../../bin/irix" \
	"INCDIR = ../../include"

sunos4-gcc:
	@$(MAKE) targets \
	"TARGET = SunOS-gnu" \
	"OS_TYPE = BSD" \
	"TARGETDIR = SunOS-gnu" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp -Dsunos4 $(DEBUGFLAG)" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) -I../regexp -Dsunos4 $(DEBUGFLAG)" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar ruv" \
	"RANLIB = ranlib" \
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/SunOS-gnu" \
	"BINDIR = ../../bin/SunOS-gnu" \
	"INCDIR = ../../include"

sunos4-gcc-sl:
	@$(MAKE) targets \
	"TARGET = SunOS-gnu" \
	"OS_TYPE = BSD" \
	"TARGETDIR = SunOS-gnu" \
	"CDEV_LIB = libcdev.so.$(CDEVVERSION)" \
	"SHOBJ = YES" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp -Dsunos4 $(DEBUGFLAG) -fpic -DSHOBJ" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp -Dsunos4 -fpic -DSHOBJ" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ld -o" \
	"RANLIB = true"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/SunOS-gnu" \
	"BINDIR = ../../bin/SunOS-gnu" \
	"INCDIR = ../../include"

solaris:
	@$(MAKE) targets \
	"TARGET = solaris" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = solaris" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = CC" \
	"CXXFLAGS = $(CXXINCLUDES) $(DEBUGFLAG) -DSYSV -DSVR4 -Dsolaris" \
	"CC = cc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -DSYSV -DSVR4 -Dsolaris" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar ruv" \
	"RANLIB = ranlib" \
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/solaris" \
	"BINDIR = ../../bin/solaris" \
	"INCDIR = ../../include"

solaris-sl:
	@$(MAKE) targets \
	"TARGET = solaris" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = solaris" \
	"CDEV_LIB = libcdev.so" \
	"SHOBJ = YES" \
	"CXX = CC" \
	"CXXFLAGS = $(CXXINCLUDES) $(DEBUGFLAG) -DSYSV -DSVR4 -Dsolaris -Kpic -DSHOBJ" \
	"CC = cc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -DSYSV -DSVR4 -Dsolaris -Kpic -DSHOBJ" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ld -G -o" \
	"RANLIB = true" \
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/solaris" \
	"BINDIR = ../../bin/solaris" \
	"INCDIR = ../../include"

solaris-gcc:
	@$(MAKE) targets \
	"TARGET = solaris-gnu" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = solaris-gnu" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I/usr/local/gnu/include/g++-include $(DEBUGFLAG) -DSYSV -DSVR4 -Dsolaris -fno-for-scope" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) -I/usr/local/gnu/include/g++-include  $(DEBUGFLAG) -DSYSV -DSVR4 -Dsolaris -fno-for-scope" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar ruv" \
	"RANLIB = ranlib" \
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/solaris-gnu" \
	"BINDIR = ../../bin/solaris-gnu" \
	"INCDIR = ../../include"

solaris-gcc-sl:
	@$(MAKE) targets \
	"TARGET = solaris-gnu" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = solaris-gnu" \
	"CDEV_LIB = libcdev.so" \
	"SHOBJ = YES" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I/usr/local/gnu/include/g++-include $(DEBUGFLAG) -DSYSV -DSVR4 -Dsolaris -fpic -fno-for-scope -DSHOBJ" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) -I/usr/local/gnu/include/g++-include $(DEBUGFLAG) -DSYSV -DSVR4 -Dsolaris -fpic -fno-for-scope -DSHOBJ" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ld -G -o" \
	"RANLIB = true" \
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/solaris-gnu" \
	"BINDIR = ../../bin/solaris-gnu" \
	"INCDIR = ../../include"

ultrix-gcc:
	@$(MAKE) targets \
	"TARGET = ultrix-gnu" \
	"OS_TYPE = BSD" \
	"TARGETDIR = ultrix-gnu" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) $(DEBUGFLAG) -I../regexp" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar ruv" \
	"RANLIB = ranlib"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/ultrix-gnu" \
	"BINDIR = ../../bin/ultrix-gnu" \
	"INCDIR = ../../include"

aix:
        @$(MAKE) targets \
        "TARGET = aix" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = aix-$(OS_MAJOR).XX" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = xlC" \
	"CXXFLAGS = $(CXXINCLUDES) $(DEBUGFLAG) -I../regexp -DAIX" \
	"CC = xlC" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar -ruv" \
	"RANLIB = ranlib"       \
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/aix-$(OS_MAJOR).XX" \
	"BINDIR = ../../bin/aix-$(OS_MAJOR).XX" \
	"INCDIR = ../../include"

linux-sl: linux-redhat6.2-x86-sl

linux-redhat6.2-x86-sl:
	@$(MAKE) targets \
	"TARGET = Linux" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = Linux" \
	"CDEV_LIB = libcdev.so" \
	"SHOBJ = YES" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp -DLinux -DCDEV_HAS_UNDERSCORE_FDBITS $(DEBUGFLAG) -fno-for-scope -fpic -DSHOBJ" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp -DLinux -DCDEV_HAS_UNDERSCORE_FDBITS -fpic -fno-for-scope -DSHOBJ" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ld -shared -o" \
	"RANLIB = true"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/Linux" \
	"BINDIR = ../../bin/Linux" \
	"INCDIR = ../../include"

linux-redhat5.2-x86-sl:
	@$(MAKE) targets \
	"TARGET = Linux" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = Linux" \
	"CDEV_LIB = libcdev.so" \
	"SHOBJ = YES" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp -DLinux $(DEBUGFLAG) -fno-for-scope -fpic -DSHOBJ" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp -DLinux -fpic -fno-for-scope -DSHOBJ" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ld -shared -o" \
	"RANLIB = true"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/Linux" \
	"BINDIR = ../../bin/Linux" \
	"INCDIR = ../../include"


linux-redhat6.0-alpha-sl:
	@$(MAKE) targets \
	"TARGET = Linux" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = Linux" \
	"CDEV_LIB = libcdev.so" \
	"SHOBJ = YES" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp -DLinux -DCDEV_HAS_UNDERSCORE_FDBITS -DCDEV_HAS_64BIT_LONGS $(DEBUGFLAG) -fno-for-scope -fpic -DSHOBJ" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp -DLinux -DCDEV_HAS_UNDERSCORE_FDBITS -DCDEV_HAS_64BIT_LONGS -fpic -fno-for-scope -DSHOBJ" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ld -shared -o" \
	"RANLIB = true"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/Linux" \
	"BINDIR = ../../bin/Linux" \
	"INCDIR = ../../include"

linux-redhat5.2-alpha-sl:
	@$(MAKE) targets \
	"TARGET = Linux" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = Linux" \
	"CDEV_LIB = libcdev.so" \
	"SHOBJ = YES" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp -DLinux -DCDEV_HAS_64BIT_LONGS $(DEBUGFLAG) -fno-for-scope -fpic -DSHOBJ" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp -DLinux -DCDEV_HAS_64BIT_LONGS -fpic -fno-for-scope -DSHOBJ" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ld -shared -o" \
	"RANLIB = true"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/Linux" \
	"BINDIR = ../../bin/Linux" \
	"INCDIR = ../../include"

linux: linux-redhat5.2-x86

linux-redhat6.0-x86:
	@$(MAKE) targets \
	"TARGET = Linux" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = Linux" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp -DLinux -DCDEV_HAS_UNDERSCORE_FDBITS $(DEBUGFLAG) -fno-for-scope" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp -DLinux -DCDEV_HAS_UNDERSCORE_FDBITS -fno-for-scope" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar -ruv" \
	"RANLIB = ranlib"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/Linux" \
	"BINDIR = ../../bin/Linux" \
	"INCDIR = ../../include"

linux-redhat5.2-x86:
	@$(MAKE) targets \
	"TARGET = Linux" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = Linux" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp -DLinux $(DEBUGFLAG) -fno-for-scope" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp -DLinux -fno-for-scope" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar -ruv" \
	"RANLIB = ranlib"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/Linux" \
	"BINDIR = ../../bin/Linux" \
	"INCDIR = ../../include"

linux-redhat6.0-alpha:
	@$(MAKE) targets \
	"TARGET = Linux" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = Linux" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp -DLinux -DCDEV_HAS_UNDERSCORE_FDBITS -DCDEV_HAS_64BIT_LONGS $(DEBUGFLAG) -fno-for-scope" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp -DLinux -DCDEV_HAS_UNDERSCORE_FDBITS -DCDEV_HAS_64BIT_LONGS -fno-for-scope" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar -ruv" \
	"RANLIB = ranlib"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/Linux" \
	"BINDIR = ../../bin/Linux" \
	"INCDIR = ../../include"

linux-redhat5.2-alpha:
	@$(MAKE) targets \
	"TARGET = Linux" \
	"OS_TYPE = SYSV" \
	"TARGETDIR = Linux" \
	"CDEV_LIB = libcdev.a" \
	"SHOBJ = NO" \
	"CXX = g++" \
	"CXXFLAGS = $(CXXINCLUDES) -I../regexp -DLinux -DCDEV_HAS_64BIT_LONGS $(DEBUGFLAG) -fno-for-scope" \
	"CC = gcc" \
	"CFLAGS = $(CINCLUDES) $(DEBUGFLAG) -I../regexp -DLinux -DCDEV_HAS_64BIT_LONGS -fno-for-scope" \
	"LEX = lex" \
	"YACC = yacc" \
	"MAKELIB = ar -ruv" \
	"RANLIB = ranlib"	\
	"OBJDIR = ../lib" \
	"LIBDIR = ../../lib/Linux" \
	"BINDIR = ../../bin/Linux" \
	"INCDIR = ../../include"

clean_hail :
	@echo "   => Cleaning $(shell pwd)"
	
ifeq ($(OS), HP-UX)
OS_VERSION_DEF     := -D_OS_MAJOR_=$(OS_MAJOR_NUM) -D_OS_MINOR_=$(OS_MINOR_NUM)
endif

# Rules

# *****************************************************
# * RULES FOR BUILDING ARCHIVE OBJECT FILES
# *****************************************************
.obj/$(TARGETDIR)/%.o : %.cc
	rm -f $@
	$(CXX_CMD_ECHO)
	$(CXX) $(CXXFLAGS) $(XTRACXXFLAGS) $(OS_VERSION_DEF) -c $< -o $@


.obj/$(TARGETDIR)/%.o : %.C
	rm -f $@
	$(CXX_CMD_ECHO)
	$(CXX) $(CXXFLAGS) $(XTRACXXFLAGS) $(OS_VERSION_DEF) -c $< -o $@
	
.obj/$(TARGETDIR)/%.o : %.c
	rm -f $@
	$(CC_CMD_ECHO)
	$(CC) $(CFLAGS) $(XTRACFLAGS) $(OS_VERSION_DEF) -c $< -o $@


# *****************************************************
# * RULES FOR BUILDING SHARED OBJECT FILES
# *****************************************************
.shobj/$(TARGETDIR)/%.o : %.cc
	rm -f $@
	$(CXX_CMD_ECHO)
	$(CXX) $(CXXFLAGS) $(XTRACXXFLAGS) $(OS_VERSION_DEF) -c $< -o $@


.shobj/$(TARGETDIR)/%.o : %.C
	rm -f $@
	$(CXX_CMD_ECHO)
	$(CXX) $(CXXFLAGS) $(XTRACXXFLAGS) $(OS_VERSION_DEF) -c $< -o $@

	
.shobj/$(TARGETDIR)/%.o : %.c
	rm -f $@
	$(CC_CMD_ECHO)
	$(CC) $(CFLAGS) $(XTRACFLAGS) $(OS_VERSION_DEF) -c $< -o $@


# *****************************************************
# * GENERIC RULES
# *****************************************************
.cc.o:
	rm -f $@
	$(CXX_CMD_ECHO)
	$(CXX) $(CXXFLAGS) $(XTRACXXFLAGS) $(OS_VERSION_DEF) -c $< -o $@


.C.o:
	rm -f $@
	$(CXX_CMD_ECHO)
	$(CXX) $(CXXFLAGS) $(XTRACXXFLAGS) $(OS_VERSION_DEF) -c $< -o $@


.c.o:
	rm -f $@
	$(CC_CMD_ECHO)
	$(CC) $(CFLAGS) $(XTRACFLAGS) $(OS_VERSION_DEF) -c $< -o $@

