| 1 |
# $Id: Makefile,v 1.11 2012-06-18 18:20:06 sverrehu Exp $ |
| 2 |
TARGETS = mancala xmancala |
| 3 |
DIST = mancala |
| 4 |
VERMAJ = 1 |
| 5 |
VERMIN = 0 |
| 6 |
VERPAT = 3 |
| 7 |
VERSION = $(VERMAJ).$(VERMIN).$(VERPAT) |
| 8 |
|
| 9 |
CC = gcc |
| 10 |
|
| 11 |
# Common directories and libraries |
| 12 |
INCDIR = -I. |
| 13 |
LIBDIR = -L. |
| 14 |
LIBS = |
| 15 |
|
| 16 |
# Directories and libraries for X, Xpm and XForms. |
| 17 |
# If you don't have Xpm, you'll need to link with a static version of XForms. |
| 18 |
XINCDIR = -I/usr/include/X11 -I/opt/local/include |
| 19 |
XLIBDIR = -L/usr/X11R6/lib -L/opt/local/lib |
| 20 |
XLIBS = -lforms |
| 21 |
|
| 22 |
OPTIM = -O3 -fomit-frame-pointer |
| 23 |
CCOPT = -Wall $(OPTIM) $(INCDIR) $(XINCDIR) -DVERSION=\"$(VERSION)\" |
| 24 |
LDOPT = -s $(LIBDIR) |
| 25 |
|
| 26 |
# Object files common to all programs. |
| 27 |
OBJS = minimax.o mancala.o |
| 28 |
|
| 29 |
# Object files used by xmancala |
| 30 |
XSRCS = xform.c rulestxt.c |
| 31 |
XOBJS = $(XSRCS:.c=.o) |
| 32 |
|
| 33 |
|
| 34 |
all: $(TARGETS) |
| 35 |
|
| 36 |
%.c %.h: %.fd |
| 37 |
fdesign -convert $< |
| 38 |
|
| 39 |
mancala: textmain.o $(OBJS) |
| 40 |
$(CC) $(CCOPT) -o $@ textmain.o $(OBJS) $(LDOPT) $(LIBS) |
| 41 |
|
| 42 |
xmancala: $(XOBJS) xmain.o $(OBJS) |
| 43 |
$(CC) $(CCOPT) -o $@ xmain.o $(XOBJS) $(OBJS) \ |
| 44 |
$(LDOPT) $(XLIBDIR) $(XLIBS) |
| 45 |
|
| 46 |
.c.o: |
| 47 |
$(CC) -o $@ -c $(CCOPT) $< |
| 48 |
|
| 49 |
clean: |
| 50 |
rm -f *.o core depend *~ xform.c xform.h |
| 51 |
|
| 52 |
veryclean: clean |
| 53 |
rm -f $(TARGETS) $(DIST)-$(VERSION).tar.gz |
| 54 |
|
| 55 |
chmod: |
| 56 |
chmod a+r * |
| 57 |
|
| 58 |
depend dep: xform.h |
| 59 |
$(CC) $(INCDIR) $(XINCDIR) -MM *.c >depend |
| 60 |
|
| 61 |
# To let the authors make a distribution. The rest of the Makefile |
| 62 |
# should be used by the authors only. |
| 63 |
LSMFILE = $(DIST)-$(VERSION).lsm |
| 64 |
DISTDIR = $(DIST)-$(VERSION) |
| 65 |
DISTFILE = $(DIST)-$(VERSION).tar.gz |
| 66 |
DISTFILES = README INSTALL RULES $(LSMFILE) ChangeLog NEWS \ |
| 67 |
Makefile Makefile.bcc \ |
| 68 |
mancala.c mancala.h minimax.c minimax.h \ |
| 69 |
textmain.c \ |
| 70 |
xform.fd xmain.c rulestxt.c mancala.6 mancala-text |
| 71 |
|
| 72 |
$(LSMFILE): FORCE |
| 73 |
VER=$(VERSION); \ |
| 74 |
DATE=`date "+%d%b%y"|tr '[a-z]' '[A-Z]'`; \ |
| 75 |
sed -e "s/VER/$$VER/g;s/DATE/$$DATE/g" $(DIST).lsm.in > $(LSMFILE) |
| 76 |
|
| 77 |
FORCE: |
| 78 |
|
| 79 |
# Warning: distclean removes the lsm-file, which can not be |
| 80 |
# regenerated without the lsm.in-file, which is not part of the package. |
| 81 |
distclean: veryclean |
| 82 |
rm -f $(LSMFILE) |
| 83 |
|
| 84 |
dist: $(LSMFILE) chmod |
| 85 |
mkdir $(DISTDIR) |
| 86 |
chmod a+rx $(DISTDIR) |
| 87 |
ln $(DISTFILES) $(DISTDIR) |
| 88 |
tar -cvzf $(DISTFILE) $(DISTDIR) |
| 89 |
chmod a+r $(DISTFILE) |
| 90 |
rm -rf $(DISTDIR) |
| 91 |
|
| 92 |
ifeq (depend,$(wildcard depend)) |
| 93 |
include depend |
| 94 |
endif |