#*******************************************************************************
#
#	Name:			Makefile
#	SCCS Id:		@(#)Makefile	1.3	08/14/05
#
#	Description:	This is the Makefile for the lock utility.
#
#					The contents of this file are subject to the terms of the
#					Common Development and Distribution License, Version 1.0
#					only.  You may not use this file except in compliance with
#					this license, a copy of which is in the file LICENSE, or
#					can be obtained from www.rite-group.com/rich/sw/CDDL.
#
#
#			Copyright  2000-2005 by Rich Teer.  All rights reserved.
#
#*******************************************************************************


PROG=lock
SRCS=lock.c $(PRIVS_SRC)
HDRS=lock.h
OBJS=$(SRCS:%.c=%.o)
PRIVS_OBJ=$(PRIVS_SRC:%.c=%.o)
CPPFLAGS=-D_POSIX_SOURCE -D__EXTENSIONS__ \
	-DLOCK_VERSION_STR='"lock 1.1"' -DLOCALE_DIR='"/opt/local/lib/locale"'

# Uncomment the following line if process privileges are supported
PRIVS_SRC = privs.c

# Uncomment the following line if process privileges are not supported
# PRIVS_SRC = privs_suid.c

# Uncomment the following three lines if the strlcpy() function is not supported
# CPPFLAGS += -DNO_STRLCPY
# SRCS += strlcpy.c
# STRLCPY_OBJ=strlcpy.o

# Uncomment the following two lines if you're using Sun's compiler
CC=c89
CFLAGS=-Xa -v -O

# Uncomment the following two lines if you're using gcc
# CC=gcc
# CFLAGS=-ansi -Wall -Wno-unknown-pragmas -O


all:	$(PROG)

lock:	$(OBJS) $(HDRS)
	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ lock.c $(PRIVS_OBJ) $(STRLCPY_OBJ)

pkg: FORCE
	@cd ../pkg; pkgmk -d .

clean:
	rm -f *.o $(PROG) core

tags: $(SRCS) $(HDRS)
	@ctags $(SRCS) $(HDRS)

lint:
	@lint $(CPPFLAGS) $(SRCS)

msg:
	@rm -f messages.po $(PROG).po
	@xgettext *.c
	@sed -e '/^\# msgid/,/^\# msgstr/d' -e '/^domain/d' messages.po > $(PROG).po
	@rm -f messages.po

#
# Tribute to a long-forgotten hack...
#
love:
	@echo Not war?

FORCE:
