# Makefile for screenblank
#
# Copyright (C) 1989, 1990, 1991, 1993, 1994, 1995 by Jef Poskanzer.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation.  This software is provided "as is" without express or
# implied warranty.

# CONFIGURE: the directory you want the executable installed into.
INSTDIR =	/usr/local/bin

# CONFIGURE: the directory tree you want the man pages installed into.
MANDIR =	/usr/local/man

# CONFIGURE: the manual section.
MANSEC =	1

# CONFIGURE: your favorite C compiler.
#CC =		cc
CC =		gcc

# CONFIGURE: your favorite C flags.
#CFLAGS =	-g
CFLAGS =	-O

# CONFIGURE: your favorite loader flags.
#LDFLAGS =
LDFLAGS =	-s


SRCS =		screenblank.c
OBJS =		screenblank.o
EXES =		screenblank
MANS =		screenblank

INCLUDES =	
ALLCFLAGS =	$(CFLAGS) $(DEFINES) $(INCLUDES)


# Change the comments here if you want a no-args "make" to do one architecture.
all:		usage
#all:		solaris2
#all:		sunos4
#all:		sunos3
#all:		bsdi

usage:
	@echo "Known targets:"
	@echo ""
	@echo "    solaris2"
	@echo "    sunos4"
	@echo "    sunos3"
	@echo "    bsdi"
	@echo "    install clean"

solaris2:
	#$(MAKE) "DEFINES =" exes
	# Hopefully temporary workaround for Solaris 2.3 - poll() is broken.
	$(MAKE) "DEFINES = -DNO_POLL" exes

sunos4:
	$(MAKE) "DEFINES = -DNO_STRERROR -DSUN_FBIO -DNO_POWERCTL -DNO_DEVFBS" exes

sunos3:
	$(MAKE) "DEFINES = -DNO_POLL -DNO_SETSID -DSUN_FBIO -DNO_POWERCTL -DNO_DEVFBS" exes

bsdi:
	$(MAKE) "DEFINES = -DNO_POLL -DNO_POWERCTL -DNO_DEVFBS -DNO_OPENKBMS" exes


exes:		$(EXES)

screenblank:	$(OBJS)
	$(CC) $(ALLCFLAGS) $(LDFLAGS) $(OBJS) -o screenblank

screenblank.o:	screenblank.c
	$(CC) $(ALLCFLAGS) -c screenblank.c


install:        all
	for i in $(EXES) ; do \
	    install -c $$i $(INSTDIR) ; \
	done
	for i in $(MANS) ; do \
	    install -c $$i.1 $(MANDIR)/man$(MANSEC)/$$i.$(MANSEC) ; \
	done

clean:
	rm -f $(EXES) *.o a.out core
