File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libpdel / GNUmakefile.in
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:25:53 2012 UTC (12 years, 2 months ago) by misho
Branches: libpdel, MAIN
CVS tags: v0_5_3, HEAD
libpdel

# $Id: GNUmakefile.in,v 1.1.1.1 2012/02/21 23:25:53 misho Exp $

#
# Variables. Edit to suit.
#
srcdir = .
top_srcdir = .
prefix = /usr/local
exec_prefix = ${prefix}
libdir = ${exec_prefix}/lib
mandir = ${prefix}/man
includedir = ${prefix}/include/pdel

ar = /usr/bin/ar
ranlib = ranlib
install = /usr/bin/install

libown = root
libgroup = 0

manown = root
mangroup = 0

includeown = root
includegroup = 0

DESTDIR =

#
# Below here should not need to be edited
#

SRCS=		@SRCS@
SRCDIRS=	@SRCDIRS@
INCS=		@INCS@
MAN=		@MAN@
MLINKS=		@MLINKS@
CFLAGS=		@CFLAGS@
SUBDIRS=	@SUBDIRS@
VERSION_MAJOR=	@VERSION_MAJOR@
VERSION_MINOR=	@VERSION_MINOR@
VERSION_PATCH=	@VERSION_PATCH@

OS=		$(shell uname -s)

EXTRAINCS=	-I$(srcdir)/ports/$(OS) -I$(prefix)/ssl/include -I/usr/kerberos/include

VPATH=		$(SRCDIRS)

objs=		$(SRCS:.c=.o)
cman=		$(foreach m,$(MAN),$(m).gz)
cc=		gcc

library=	libpdel.a

all:		$(library) $(cman)

%.gz:		%
	gzip < $+ > $@

%.o:		%.c
	$(cc) -c -o $@ $(CFLAGS) -include $(srcdir)/ports/$(OS)/hacks.h -I$(srcdir) $(EXTRAINCS) $+

$(library):	$(objs)
	$(ar) rv $@ $(objs)
	$(ranlib) $@

clean:
	rm -f $(objs) $(library) $(cman)

install:	install-library install-header-dirs install-headers install-man

uninstall:	uninstall-library uninstall-headers uninstall-man

install-library:	$(library)
	$(install) -c -o $(libown) -g $(libgroup) -m 444 \
	    $(library) $(DESTDIR)$(libdir)/$(library)

uninstall-library:
	rm -f $(DESTDIR)$(libdir)/$(library)

install-header-dirs:
	@incdirs=`echo $(INCS) | awk '{for(i=1;i<=NF;i++)print $$i}' \
	    | grep / | sed 's,^\(.*\)/[^/][^/]*$$,\1,g' | sort -u`; \
	for dir in $$incdirs; do \
		if ! [ -d $(DESTDIR)$(includedir)$$dir ]; then \
			echo $(install) -d -o $(includeown) -g $(includegroup) \
			    -m 0755 $(DESTDIR)$(includedir)/$$dir; \
			$(install) -d -o $(includeown) -g $(includegroup) \
			    -m 0755 $(DESTDIR)$(includedir)/$$dir; \
		fi; \
	done

install-headers:
	@for hdr in $(INCS); do \
		echo $(install) -c -o $(includeown) -g $(includegroup) -m 444 \
		    $$hdr $(DESTDIR)$(includedir)/$$hdr; \
		$(install) -c -o $(includeown) -g $(includegroup) -m 444 \
		    $$hdr $(DESTDIR)$(includedir)/$$hdr; \
	done

uninstall-headers:
	@for hdr in $(INCS); do \
		echo rm -f $(DESTDIR)$(includedir)/$$hdr; \
		rm -f $(DESTDIR)$(includedir)/$$hdr; \
	done

install-man:	install-manpages install-manlinks

uninstall-man:	uninstall-manpages uninstall-manlinks

install-manpages:	$(cman)
	@for p in $(MAN); do \
		section=`echo $$p | sed 's/^[^.]*.//g'`; \
		f=`basename $$p`; \
		if [ ! -d $(DESTDIR)$(mandir)/man$$section ]; then \
			echo $(install) -d -o $(manown) -g $(mangroup) -m 755 \
			    $(DESTDIR)$(mandir)/man$$section; \
			$(install) -d -o $(manown) -g $(mangroup) -m 755 \
			    $(DESTDIR)$(mandir)/man$$section; \
		fi; \
		echo $(install) -c -o $(manown) -g $(mangroup) -m 444 \
		    $$p.gz $(DESTDIR)$(mandir)/man$$section/$$f.gz; \
		$(install) -c -o $(manown) -g $(mangroup) -m 444 \
		    $$p.gz $(DESTDIR)$(mandir)/man$$section/$$f.gz; \
	done

uninstall-manpages:
	@for p in $(MAN); do \
		section=`echo $$p | sed 's/^[^.]*.//g'`; \
		f=`basename $$p`; \
		echo rm -f $(DESTDIR)$(mandir)/man$$section/$$f.gz; \
		rm -f $(DESTDIR)$(mandir)/man$$section/$$f.gz; \
	done

install-manlinks:
	@set `echo $(MLINKS) " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \
	while : ; do \
		case $$# in \
			0) break;; \
			[123]) echo "warn: empty MLINK: $$1 $$2 $$3"; break;; \
		esac; \
		name=$$1; shift; sect=$$1; shift; \
		l=$(DESTDIR)$(mandir)/man$$sect/$$name; \
		name=$$1; shift; sect=$$1; shift; \
		t=$(DESTDIR)$(mandir)/man$$sect/$$name; \
		echo $$t.gz -\> $$l.gz; \
		rm -f $$t $$t.gz; \
		ln $$l.gz $$t.gz; \
	done

uninstall-manlinks:
	@set `echo $(MLINKS) " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \
	while : ; do \
		case $$# in \
			0) break;; \
			[123]) echo "warn: empty MLINK: $$1 $$2 $$3"; break;; \
		esac; \
		name=$$1; shift; sect=$$1; shift; \
		l=$(DESTDIR)$(mandir)/man$$sect/$$name; \
		name=$$1; shift; sect=$$1; shift; \
		t=$(DESTDIR)$(mandir)/man$$sect/$$name; \
		echo rm -f $$t.gz; \
		rm -f $$t.gz; \
	done


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>