"Fossies" - the Fresh Open Source Software Archive

Member "libsafe-2.0-16/src/Makefile" (30 May 2002, 4559 Bytes) of package /linux/misc/old/libsafe-2.0-16.tgz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #
    2 # $Name: release2_0-16 $
    3 # $Id: Makefile,v 1.52 2002/05/30 14:13:07 ttsai Exp $
    4 #
    5 # Copyright (C) 2002 Avaya Labs, Avaya Inc.
    6 # Copyright (C) 1999 Bell Labs, Lucent Technologies.
    7 # Copyright (C) Arash Baratloo, Timothy Tsai, and Navjot Singh.
    8 # 
    9 # This file is part of the Libsafe library.
   10 # Libsafe version 2.x: protecting against stack smashing attacks.
   11 # 
   12 # This library is free software; you can redistribute it and/or
   13 # modify it under the terms of the GNU Lesser General Public
   14 # License as published by the Free Software Foundation; either
   15 # version 2.1 of the License, or (at your option) any later version.
   16 # 
   17 # This library is distributed in the hope that it will be useful,
   18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   20 # Lesser General Public License for more details.
   21 # 
   22 # You should have received a copy of the GNU Lesser General Public
   23 # License along with this library; if not, write to the Free Software
   24 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   25 # For more information, 
   26 # 
   27 #   visit http://www.research.avayalabs.com/project/libsafe/index.html
   28 #   or email libsafe@research.avayalabs.com
   29 
   30 
   31 MAJOR_VERSION	= 2
   32 MINOR_VERSION	= 0
   33 PATCHLEVEL	= 16
   34 
   35 VERSION		= $(MAJOR_VERSION).$(MINOR_VERSION).$(PATCHLEVEL)
   36 
   37 LIBNAME		= libsafe.so.$(VERSION)
   38 LIBLINK		= libsafe.so.$(MAJOR_VERSION)
   39 LIBDIR		= /lib
   40 PRELOAD		= /etc/ld.so.preload
   41 
   42 MANNAME		= ../doc/libsafe.8
   43 MANDIR		= /usr/man/man8
   44 
   45 CC		= gcc
   46 CPP		= g++
   47 DEPEND		= gcc -M
   48 RANLIB		= ranlib
   49 INSTALL		= install
   50 
   51 LIBPRELUDE_LIBS = $(shell if (libprelude-config --libs >/dev/null 2>&1); then libprelude-config --libs; fi)
   52 LIBPRELUDE_CFLAGS = $(shell if (libprelude-config --cflags >/dev/null 2>&1); then libprelude-config --cflags && echo -DHAVE_LIBPRELUDE; fi)
   53 
   54 LDFLAGS		= -shared -Wl,-soname,${LIBLINK} -ldl $(LIBPRELUDE_LIBS)
   55 SRCS		= util.c intercept.c
   56 OBJECTS		= util.o intercept.o
   57 HEADERS		= log.h util.h
   58 
   59 ###############################################################################
   60 
   61 # DEBUGGING OPTIONS
   62 #
   63 # Use
   64 # 	-DDEBUG_TURN_OFF_SYSLOG to temporarily turn off logging violations to
   65 #	 	syslog.  ONLY USE THIS FOR DEBUGGING!
   66 #	-DDUMP_STACK to see a printout of the stack contents when a violation
   67 #		is detected (dumps to LIBSAFE_DUMP_STACK_FILE or stderr if that
   68 #		file can't be created)
   69 #	-DDUMP_CORE to create a core dump when terminating the program.
   70 #	-DNOTIFY_WITH_EMAIL if you wish to be notified via email of security
   71 #		violations that are caught with libsafe.
   72 DEBUG_FLAGS	= -DDEBUG_TURN_OFF_SYSLOG \
   73 		  -DDUMP_STACK \
   74 		  -DLIBSAFE_DUMP_STACK_FILE=\"/tmp/libsafe_stack_dump\" \
   75 		  -DDUMP_CORE \
   76 		  -DNOTIFY_WITH_EMAIL
   77 CCFLAGS		= -O2 -Wall -fPIC -DLIBSAFE_VERSION=\"$(VERSION)\" $(LIBPRELUDE_CFLAGS)
   78 # Uncomment the following line to enable all debugging options.  Better way is
   79 # to do "make debug".
   80 #CCFLAGS		= -O2 -Wall -fPIC $(DEBUG_FLAGS)
   81 
   82 # For Red Hat 5.2 and other distributions that don't support wcsnlen(),
   83 # uncomment the following:
   84 #CCFLAGS		+= -DMISSING_WCSNLEN
   85 
   86 ###############################################################################
   87 
   88 
   89 all	::	$(LIBNAME)
   90 
   91 %.o	:	%.c
   92 		$(CC) -c -o $@ $(CCFLAGS) $<
   93 
   94 ${LIBNAME}:	dep $(OBJECTS)
   95 		$(CC) -o ${LIBNAME} $(LDFLAGS) ${OBJECTS}
   96 		ln -sf $(LIBNAME) libsafe.so
   97 
   98 debug	:	CCFLAGS += $(DEBUG_FLAGS)
   99 debug	:	all
  100 
  101 dep	::	$(SRCS) $(HEADERS)
  102 		$(DEPEND) $(CFLAGS) $(SRCS) > dep
  103 
  104 clean	::
  105 		rm -f core *.bak *% *~ *.o a.out dep
  106 		rm -f libsafe.so*
  107 
  108 purge	::	clean
  109 		rm -f $(LIBNAME)
  110 
  111 install	::	all
  112 
  113 
  114 		@if [ -f $(PRELOAD) ] ; then \
  115 		 echo "Removing libsafe from $(PRELOAD) (if exists)"; \
  116 		 cp -fp $(PRELOAD) $(PRELOAD).save ; \
  117 		 grep -v libsafe $(PRELOAD) > $(PRELOAD).tmp ; \
  118 		 rm -f $(PRELOAD) ;\
  119 		fi; \
  120 
  121 		$(INSTALL) $(LIBNAME) $(LIBDIR) 
  122 		/sbin/ldconfig
  123 
  124 		 @if [ -s $(PRELOAD).tmp ] ; then \
  125 		  cp -fp $(PRELOAD).tmp $(PRELOAD);\
  126 		 fi ;\
  127 		 rm -f $(PRELOAD).tmp 
  128 
  129 		@echo -n "Type y for installing libsafe system wide?[default n] ";\
  130 		read reply; \
  131 		if [ "$$reply" = 'y' ] ; then \
  132 	         if [ -f $(LIBDIR)/$(LIBLINK) ] ; then \
  133 		  echo "$(LIBDIR)/$(LIBLINK)" >> $(PRELOAD) ; \
  134 		 fi; \
  135 		fi
  136 
  137 # If you have man pages in some other directory  add it here.
  138 
  139 		@if [  -d $(MANDIR) ];  then \
  140 		 echo "$(INSTALL) $(MANNAME) $(MANDIR)"; \
  141 		 $(INSTALL) $(MANNAME) $(MANDIR); \
  142 		elif [  -d /usr/share/man/man8 ];  then \
  143 		  echo "$(INSTALL) $(MANNAME) /usr/share/man/man8"; \
  144 		  $(INSTALL) $(MANNAME) /usr/share/man/man8; \
  145 		else echo "***** Error: Cannot find man directories"; \
  146 		fi
  147