File: Makefile

package info (click to toggle)
mancala 1.0.1-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 248 kB
  • sloc: ansic: 1,234; makefile: 185; sh: 6
file content (94 lines) | stat: -rw-r--r-- 2,162 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# $Id: Makefile,v 1.7 2007-06-13 18:29:52 sverrehu Exp $
TARGETS		= mancala xmancala
DIST		= mancala
VERMAJ		= 1
VERMIN		= 0
VERPAT		= 1
VERSION		= $(VERMAJ).$(VERMIN).$(VERPAT)

CC		= gcc

# Common directories and libraries
INCDIR		= -I.
LIBDIR		= -L.
LIBS		= 

# Directories and libraries for X, Xpm and XForms.
# If you don't have Xpm, you'll need to link with a static version of XForms.
XINCDIR		= -I/usr/include/X11
XLIBDIR		= -L/usr/X11R6/lib
XLIBS		= -lforms

OPTIM		= -O3 -fomit-frame-pointer
CCOPT		= -Wall $(OPTIM) $(INCDIR) $(XINCDIR) -DVERSION=\"$(VERSION)\"
LDOPT		= -s $(LIBDIR)

# Object files common to all programs.
OBJS		= minimax.o mancala.o

# Object files used by xmancala
XSRCS		= xform.c rulestxt.c
XOBJS		= $(XSRCS:.c=.o)


all: $(TARGETS)

%.c %.h: %.fd
	fdesign -convert $<

mancala: textmain.o $(OBJS)
	$(CC) $(CCOPT) -o $@ textmain.o $(OBJS) $(LDOPT) $(LIBS)

xmancala: $(XOBJS) xmain.o $(OBJS)
	$(CC) $(CCOPT) -o $@ xmain.o $(XOBJS) $(OBJS) \
		$(LDOPT) $(XLIBDIR) $(XLIBS)

.c.o:
	$(CC) -o $@ -c $(CCOPT) $<

clean:
	rm -f *.o core depend *~  xform.c xform.h

veryclean: clean
	rm -f $(TARGETS) $(DIST)-$(VERSION).tar.gz

chmod:
	chmod a+r *

depend dep:
	$(CC) $(INCDIR) $(XINCDIR) -MM *.c >depend

# To let the authors make a distribution. The rest of the Makefile
# should be used by the authors only.
LSMFILE		= $(DIST)-$(VERSION).lsm
DISTDIR		= $(DIST)-$(VERSION)
DISTFILE	= $(DIST)-$(VERSION).tar.gz
DISTFILES	= README INSTALL RULES $(LSMFILE) \
		  Makefile Makefile.bcc \
		  mancala.c mancala.h minimax.c minimax.h \
		  textmain.c \
		  xform.fd xmain.c rulestxt.c

$(LSMFILE): FORCE
	VER=$(VERSION); \
	DATE=`date "+%d%b%y"|tr '[a-z]' '[A-Z]'`; \
	sed -e "s/VER/$$VER/g;s/DATE/$$DATE/g" $(DIST).lsm.in > $(LSMFILE)

FORCE:

# Warning: distclean removes the lsm-file, which can not be
# regenerated without the lsm.in-file, which is not part of the package.
distclean: veryclean
	rm -f $(LSMFILE)

dist: $(LSMFILE) chmod
	mkdir $(DISTDIR)
	chmod a+rx $(DISTDIR)
	ln $(DISTFILES) $(DISTDIR)
	tar -cvzf $(DISTFILE) $(DISTDIR)
	chmod a+r $(DISTFILE)
	rm -rf $(DISTDIR)

ifeq (depend,$(wildcard depend))
include depend
endif