head     1.1;
access   ;
symbols  KSUrelease-Aug93:1.1;
locks    ; strict;
comment  @# @;


1.1
date     89.12.14.13.25.45;  author jay;  state Exp;
branches ;
next     ;


desc
@@



1.1
log
@Initial revision
@
text
@# Generic makefile stuff.  This file is included by all 
# the makefiles in the distribution.

# The following variable is automatically filled on by "make depend".
SRCDIR= /users/jay/src/games/empire/EMP
GAMEDIR= $(SRCDIR)

NROFF := nroff
TROFF := troff

LIBDIR := $(SRCDIR)/lib
MAKEDIR := $(SRCDIR)/make

include $(MAKEDIR)/UtilMakefile

ifdef SYSTYPE
include $(MAKEDIR)/Systems/$(SYSTYPE)
endif

# The following variables are configurable.
#-----------------------------------#
GLOBALCFLAGS := 
GLOBALIFLAGS := -I$(SRCDIR)/h
GLOBALLFLAGS := -g
GLOBALSFLAGS :=

LINTFLAGS := -bhuz -I$(SRCDIR)/h

CC := /bin/cc
BSD := 4.3
BINDIR := $(GAMEDIR)/bin
DEPENDFILE := GNUdepend
#-----------------------------------#

# Other variables
CFLAGS := $(LOCALCFLAGS) $(GLOBALCFLAGS)
IFLAGS := $(LOCALIFLAGS) $(GLOBALIFLAGS)
LFLAGS := $(LOCALLFLAGS) $(GLOBALLFLAGS)
SFLAGS := $(LOCALSFLAGS) $(GLOBALSFLAGS)

ifdef ARCH
DEPENDENCIES := $(ARCH)/$(DEPENDFILE)
else
DEPENDENCIES := $(DEPENDFILE)
endif

# Rules
$(DEPENDFILE):
	cp $(MAKEDIR)/DependTmpl $@@
	@@echo "Remember to run $(MAKE) depend!"

ifdef ARCH
$(ARCH)/%.o: %.c
	$(CC) -c $(IFLAGS) $(CFLAGS) $<
	@@mv $*.o $@@

$(ARCH)/$(DEPENDFILE): $(DEPENDFILE)
	@@-if [ ! -d $(ARCH) ]; then mkdir $(ARCH); fi
	@@echo "Updating $@@..."
	@@awk '{ if ($$1 ~ /\.o:/) print "$(ARCH)/"$$0; else print; }' $< > $@@
endif # ARCH

%.o: %.c
	$(CC) -c $(IFLAGS) $(CFLAGS) $<

# Productions
#	depend: create dependencies file for thie directory.
#	lintlib: create a lint library (LINTNAME must be set).
#	lint: run lint on the srcs (LINTLIBS may be set).

.PHONY: depend lintlib lint 

depend:
	@@echo "Making depend.  The errors can be ignored."
	@@mkmf -f $(DEPENDFILE) 'CFLAGS=$(IFLAGS)'

ifeq "$(origin LINTNAME)" "file"
LINTLIB := llib-l$(LINTNAME).ln
lintlib: $(LINTLIB)
$(LINTLIB): $(SRCS)
	lint -I$(SRCDIR)/h -C$(LINTNAME) $(SRCS)
	@@rm -f $(LIBDIR)/$@@
	@@ln $@@ $(LIBDIR)/$@@
endif

lint: $(SRCS)
	lint $(LINTFLAGS) $(SRCS) \
		$(patsubst %,$(LIBDIR)/llib-l%.ln,$(LINTLIBS))

@
