Add to git.
[dlife.git] / Makefile+
1 # -*- Makefile -*-
2 #
3 # This is a make+ file. Make+ is a set of scripts which enhance GNU
4 # make and let you build RPMs, and other package types with just one
5 # control file.  To build this package you will need to download make+
6 # from this site: http://www.annexia.org/freeware/makeplus/
7
8 PACKAGE         := dlife
9 VERSION_MAJOR   := 1
10 VERSION_MINOR   := 1.0
11 VERSION         := $(VERSION_MAJOR).$(VERSION_MINOR)
12
13 SUMMARY         := Distributed artificial life
14 COPYRIGHT       := GPL
15 AUTHOR          := Richard W.M. Jones <rich@annexia.org>
16
17 define DESCRIPTION
18 Distributed Artificial Life is a package for joining your
19 computer to a network of computers running a large artificial
20 life simulation.
21 endef
22
23 RPM_REQUIRES    := perl-libwww-perl, perl >= 5.004, vixie-cron, SysVinit
24 RPM_GROUP       := Applications/Internet
25
26 spooldir = $(localstatedir)/spool/dlife
27 confdir = $(sysconfdir)/dlife
28 crondir = $(sysconfdir)/cron.d
29 rcdir   = $(sysconfdir)/init.d
30
31 CFLAGS          += -Wall -Werror -g -O2 \
32                    -DCONFDIR=\"$(confdir)\" \
33                    -DSPOOLDIR=\"$(spooldir)\"
34 #LIBS           +=
35
36 ifdef ENABLE_CHECK
37 CFLAGS          += -DCHECK=1
38 endif
39
40 ifdef ENABLE_PROFILE
41 CFLAGS          += -pg
42 endif
43
44 DOCS    := $(srcdir)/AUTHORS $(srcdir)/INSTALL $(srcdir)/README \
45            $(srcdir)/archproc.gif $(srcdir)/archproc.fig \
46            $(srcdir)/archref.html $(srcdir)/index.html \
47            $(srcdir)/machineref.html
48
49 OBJS    := cell.o crc.o exec.o image.o load.o main.o random.o soup.o state.o
50
51 all:    build
52
53 configure:
54         $(MP_CONFIGURE_START)
55         $(MP_CHECK_HEADERS) assert.h dirent.h errno.h fcntl.h grp.h pwd.h \
56           signal.h stddef.h stdint.h string.h sys/param.h sys/types.h \
57           syslog.h time.h unistd.h
58         $(MP_CHECK_FUNCS) closedir getpwnam getuid initgroups nice opendir \
59           openlog readdir setgid setuid syslog
60 ifndef DISABLE_USER_CHECK
61 #       $(MP_CHECK_USER_GROUP) dlife dlife
62 endif
63         $(MP_CONFIGURE_END)
64
65 build:  dlife_soup
66
67 dlife_soup: $(OBJS)
68         $(CC) $(CFLAGS) $^ $(LIBS) -o $@
69
70 test:
71
72 install:
73         install -d $(DESTDIR)$(bindir)
74         install -d $(DESTDIR)$(docdir)
75         install -d $(DESTDIR)$(spooldir)
76         install -d $(DESTDIR)$(spooldir)/incoming
77         install -d $(DESTDIR)$(spooldir)/outgoing
78         install -d $(DESTDIR)$(spooldir)/saved
79         install -d $(DESTDIR)$(spooldir)/store
80         install -d $(DESTDIR)$(confdir)
81         install -d $(DESTDIR)$(crondir)
82         install -d $(DESTDIR)$(rcdir)
83
84         install -m 0755 dlife_soup $(srcdir)/dlife_client.pl \
85           $(srcdir)/dlife_server.pl $(DESTDIR)$(bindir)
86         install -m 0644 $(DOCS) $(DESTDIR)$(docdir)
87         install -m 0644 god.dlo $(DESTDIR)$(spooldir)
88         install -m 0644 $(srcdir)/client.conf $(srcdir)/soup.conf \
89           $(DESTDIR)$(confdir)
90         install -m 0644 $(srcdir)/dlife_client.cron $(DESTDIR)$(crondir)
91         install -m 0644 $(srcdir)/dlife.rc $(DESTDIR)$(rcdir)
92
93         chown -R dlife.dlife $(DESTDIR)$(spooldir) ||:
94
95 define WEBSITE
96 <html>
97 XXX PUT YOUR WEBSITE HERE. IF YOU DON\'T WANT TO MANAGE A WEBSITE WITH
98 XXX MAKE+ THEN JUST DELETE THIS SECTION AND THE upload_website RULE.
99 </html>
100 endef
101
102 upload_website:
103         scp $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)-1.*.rpm \
104         $(PACKAGE)-$(VERSION).bin.tar.gz \
105         you@yourmachine.example.com:/var/www/html/$(PACKAGE)/files
106         scp index.html you@yourmachine.example.com:/var/www/html/$(PACKAGE)/
107
108 .PHONY: build configure test upload_website