1# These two definitions are used if you 'make install'
2# the value of LIBDIR should be the same as OMEGALIB in defs.h
3BINDIR = ${PREFIX}/bin
4LIBDIR = ${PREFIX}/share/omega
5
6# One of these should be uncommented, as appropriate, unless your compiler
7# does it for you.  You can test this by simply trying to 'make' omega -
8# it will fail if none of them are defined.  If you do uncomment
9# one, make sure you comment out the other definition of CFLAGS lower down
10
11CFLAGS+= -DBSD -DOMEGALIB=\"${LIBDIR}/\"
12#CFLAGS = -DSYSV -O
13# I also had to define -cckr (K&R style C) for system V
14#CFLAGS = -DMSDOS -O
15#CFLAGS = -DAMIGA -O
16
17# CPP should contain the command to run the C preprocessor.
18#CPP = cc -E
19#CPP = /lib/cpp
20CPP = ${CC} -E
21
22# If you have gcc and don't intend to hack around with the game,
23# I recommend setting CC to gcc and using -O (as the CFLAGS).
24
25#CFLAGS = -O
26#LDFLAGS = -s
27#CC = gcc
28
29# comment out one of the following two, after establishing whether your
30# machine uses termcap (most BSD machines) or terminfo (System-V)
31#LIBS = -lcurses -ltermcap
32#LIBS = -lcurses -ltermlib
33# Linux links in term?? automatically.
34LIBS = -lncurses
35
36#################### that's it for changing the Makefile ####################
37
38OBJ = omega.o abyss.o aux1.o aux2.o aux3.o char.o city.o\
39      clrgen.o command1.o command2.o command3.o\
40      country.o effect1.o effect2.o effect3.o\
41      etc.o env.o file.o gen1.o gen2.o guild1.o guild2.o house.o\
42      init.o inv.o item.o itemf1.o itemf2.o itemf3.o lev.o\
43      mmelee.o mmove.o mon.o move.o movef.o mspec.o\
44      mstrike.o mtalk.o priest.o\
45      save.o scr.o site1.o site2.o\
46      spell.o time.o trap.o util.o village.o compress.o
47
48omega: $(OBJ)
49	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) $(LIBS) -o omega
50
51install: omega
52	mkdir -p $(BINDIR)
53	mkdir -p $(LIBDIR)
54	chown games:games omega
55	cp omega $(BINDIR)
56	chmod 4711 $(BINDIR)/omega
57	- cp lib/* $(LIBDIR)
58	chmod 0644 $(LIBDIR)/help*.txt $(LIBDIR)/license.txt $(LIBDIR)/motd.txt $(LIBDIR)/thanks.txt $(LIBDIR)/update.txt
59	chmod 0600 $(LIBDIR)/abyss.txt $(LIBDIR)/scroll[1234].txt $(LIBDIR)/*.dat
60	chmod 0600 $(LIBDIR)/omega.hi $(LIBDIR)/omega.log $(LIBDIR)/omegahi.bak
61
62install_not_suid: omega $(BINDIR) $(LIBDIR)
63	cp omega $(BINDIR)
64	chmod 0711 $(BINDIR)/omega
65	- cp lib/* $(LIBDIR)
66	chmod 0644 $(LIBDIR)/help*.txt $(LIBDIR)/license.txt $(LIBDIR)/motd.txt $(LIBDIR)/thanks.txt $(LIBDIR)/update.txt
67	chmod 0644 $(LIBDIR)/abyss.txt $(LIBDIR)/scroll[1234].txt $(LIBDIR)/*.dat
68	chmod 0666 $(LIBDIR)/omega.hi $(LIBDIR)/omega.log
69	chmod 0600 $(LIBDIR)/omegahi.bak
70
71clean:
72	rm -f $(OBJ) genclr genclr.o
73	rm -i omega
74
75$(OBJ): clrgen.h defs.h extern.h glob.h
76
77clrgen.c: genclr
78	$(CPP) $(CFLAGS) -DOMEGA_CLRGEN *.[ch] | ./genclr clrgen.c clrgen.h
79clrgen.h: | clrgen.c
80
81genclr: genclr.o
82	$(CC) $(CFLAGS) $(LDFLAGS) genclr.o -o genclr
83