Mercurial > hg > early-roguelike
annotate arogue7/Makefile.in @ 176:db1c9a21a7c3
srogue: prevent overflowing the score file name.
If SCOREFILE is not defined, roguehome() is called to find a directory
for the score file. It copies up to PATH_MAX-20 bytes from an
environment variable to a static buffer. Later these are strcpy()'d to
scorefile, which is of size LINLEN. Unfortunately LINLEN is 80 and
PATH_MAX is at least 256. On Linux, it happens to be 4096.
I haven't yet managed to crash or exploit it, but there are surely no
beneficial consequences, so roguehome() has been modified to check the
length, and the string it returns is also checked in main().
author | John "Elwin" Edwards |
---|---|
date | Sun, 02 Aug 2015 12:14:47 -0400 |
parents | 2d221d574280 |
children | 0e99eade579c |
rev | line source |
---|---|
125
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
1 # |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
2 # Makefile for rogue |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
3 # |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
4 # Advanced Rogue |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
5 # Copyright (C) 1984, 1985, 1986 Michael Morgan, Ken Dalka and AT&T |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
6 # All rights reserved. |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
7 # |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
8 # Based on "Rogue: Exploring the Dungeons of Doom" |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
9 # Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
10 # All rights reserved. |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
11 # |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
12 # See the file LICENSE.TXT for full copyright and licensing information. |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
13 # |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
14 |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
15 # |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
16 # Makefile for rogue |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
17 # |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
18 |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
19 |
156
3e1146666ae5
arogue7, xrogue: begin using autoconf.
John "Elwin" Edwards
parents:
125
diff
changeset
|
20 DISTNAME=@PACKAGE_TARNAME@@PACKAGE_VERSION@ |
3e1146666ae5
arogue7, xrogue: begin using autoconf.
John "Elwin" Edwards
parents:
125
diff
changeset
|
21 PROGRAM=@PROGRAM@ |
158
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
22 PACKAGE_TARNAME=@PACKAGE_TARNAME@-@PACKAGE_VERSION@ |
156
3e1146666ae5
arogue7, xrogue: begin using autoconf.
John "Elwin" Edwards
parents:
125
diff
changeset
|
23 |
3e1146666ae5
arogue7, xrogue: begin using autoconf.
John "Elwin" Edwards
parents:
125
diff
changeset
|
24 SAVEDIR=@SAVEDIR@ |
3e1146666ae5
arogue7, xrogue: begin using autoconf.
John "Elwin" Edwards
parents:
125
diff
changeset
|
25 SCOREFILE=@SCOREFILE@ |
3e1146666ae5
arogue7, xrogue: begin using autoconf.
John "Elwin" Edwards
parents:
125
diff
changeset
|
26 LOGFILE=@LOGFILE@ |
3e1146666ae5
arogue7, xrogue: begin using autoconf.
John "Elwin" Edwards
parents:
125
diff
changeset
|
27 GROUPOWNER=@GROUPOWNER@ |
125
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
28 |
158
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
29 DESTDIR= |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
30 prefix=@prefix@ |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
31 exec_prefix=@exec_prefix@ |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
32 datarootdir=@datarootdir@ |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
33 bindir=@bindir@ |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
34 docdir=@docdir@ |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
35 |
125
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
36 O=o |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
37 |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
38 HDRS= rogue.h mach_dep.h network.h |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
39 |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
40 OBJS1 = vers.$(O) actions.$(O) chase.$(O) command.$(O) daemon.$(O) \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
41 daemons.$(O) eat.$(O) effects.$(O) encumb.$(O) fight.$(O) init.$(O) \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
42 io.$(O) list.$(O) main.$(O) maze.$(O) mdport.$(O) misc.$(O) \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
43 monsters.$(O) |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
44 OBJS2 = move.$(O) new_level.$(O) options.$(O) outside.$(O) pack.$(O) \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
45 passages.$(O) player.$(O) potions.$(O) rings.$(O) rip.$(O) rogue.$(O) \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
46 rooms.$(O) save.$(O) scrolls.$(O) state.$(O) sticks.$(O) things.$(O) \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
47 trader.$(O) util.$(O) weapons.$(O) wear.$(O) wizard.$(O) xcrypt.$(O) |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
48 OBJS = $(OBJS1) $(OBJS2) |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
49 |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
50 CFILES= vers.c actions.c chase.c command.c daemon.c \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
51 daemons.c eat.c effects.c encumb.c fight.c init.c \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
52 io.c list.c main.c maze.c mdport.c misc.c monsters.c \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
53 move.c new_level.c options.c outside.c pack.c \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
54 passages.c player.c potions.c rings.c rip.c rogue.c \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
55 rooms.c save.c scrolls.c state.c sticks.c things.c \ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
56 trader.c util.c weapons.c wear.c wizard.c xcrypt.c |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
57 MISC_C= |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
58 DOCSRC= aguide.mm |
158
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
59 #DOCS = $(PROGRAM).doc $(PROGRAM).html |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
60 DOCS = arogue77.doc arogue77.html |
125
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
61 MISC = Makefile $(MISC_C) LICENSE.TXT $(PROGRAM).sln $(PROGRAM).vcproj $(DOCS)\ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
62 $(DOCSRC) |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
63 |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
64 CC = gcc |
156
3e1146666ae5
arogue7, xrogue: begin using autoconf.
John "Elwin" Edwards
parents:
125
diff
changeset
|
65 CPPFLAGS =@DEFS@ |
125
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
66 ROPTS = |
160
2d221d574280
arogue7, xrogue: set CFLAGS empty by default in the Makefiles.
John "Elwin" Edwards
parents:
158
diff
changeset
|
67 COPTS = |
125
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
68 CFLAGS= $(COPTS) $(ROPTS) |
156
3e1146666ae5
arogue7, xrogue: begin using autoconf.
John "Elwin" Edwards
parents:
125
diff
changeset
|
69 LIBS = @LIBS@ |
125
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
70 RM = rm -f |
158
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
71 INSTALL=@INSTALL@ |
125
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
72 |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
73 .SUFFIXES: .obj |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
74 |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
75 .c.obj: |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
76 $(CC) $(CFLAGS) /c $*.c |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
77 |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
78 $(PROGRAM): $(HDRS) $(OBJS) |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
79 $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ |
adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
80 |
158
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
81 install: $(PROGRAM) |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
82 -touch test |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
83 -if test ! -f $(DESTDIR)$(SCOREFILE) ; \ |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
84 then $(INSTALL) -m 0664 test $(DESTDIR)$(SCOREFILE) ; fi |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
85 -if test "x$(LOGFILE)" != "x" && test ! -f $(DESTDIR)$(LOGFILE) ; then \ |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
John "Elwin" Edwards
parents:
156
diff
changeset
|
86 $(INSTALL) -m 0664 test $(DESTDIR)$(LOGFILE) ; fi |
2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles. |