Mercurial > hg > early-roguelike
annotate arogue5/Makefile.in @ 280:70aa5808c782
Fix potential segfaults at restore related to ctime().
In some games, restore() passes the result of ctime() to mvprintw() or
some other variadic message-formatting function. If ctime() has not
been declared properly, its return type is inferred to be int instead
of char *. This does not cause a warning because the compiler does not
know the correct type of variadic arguments.
On platforms where ints and pointers are not the same size, this can,
probably depending on alignment, result in a segfault that is not easy
to trace.
Including time.h fixes the problem. Some games manually declared
ctime() and avoided the bug. These declarations have also been
replaced with the include.
author | John "Elwin" Edwards |
---|---|
date | Fri, 15 Sep 2017 20:51:10 -0400 |
parents | bac2c81fec78 |
children | 0b3d1b38998f |
rev | line source |
---|---|
99 | 1 # |
2 # Makefile for rogue | |
3 # | |
4 # Advanced Rogue | |
5 # Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T | |
6 # All rights reserved. | |
7 # | |
8 # Based on "Rogue: Exploring the Dungeons of Doom" | |
9 # Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman | |
10 # All rights reserved. | |
11 # | |
12 # See the file LICENSE.TXT for full copyright and licensing information. | |
13 # | |
14 | |
15 DISTNAME=@PACKAGE_TARNAME@@PACKAGE_VERSION@ | |
16 PACKAGE_TARNAME=@PACKAGE_TARNAME@-@PACKAGE_VERSION@ | |
17 PROGRAM=@PROGRAM@ | |
18 | |
19 SCOREFILE=@SCOREFILE@ | |
20 LOGFILE=@LOGFILE@ | |
21 SAVEDIR=@SAVEDIR@ | |
22 GROUPOWNER=@GROUPOWNER@ | |
23 | |
24 DESTDIR= | |
25 prefix=@prefix@ | |
26 exec_prefix=@exec_prefix@ | |
27 datarootdir=@datarootdir@ | |
28 bindir=@bindir@ | |
29 docdir=@docdir@ | |
30 | |
31 O=o | |
32 | |
104
fbc75509f4cd
Add config.h to the list of headers in the Makefiles.
John "Elwin" Edwards
parents:
99
diff
changeset
|
33 HDRS = rogue.h mach_dep.h network.h config.h |
99 | 34 OBJS1 = chase.$(O) command.$(O) daemon.$(O) daemons.$(O) encumb.$(O) \ |
35 fight.$(O) init.$(O) io.$(O) list.$(O) main.$(O) maze.$(O) mdport.$(O)\ | |
36 misc.$(O) monsters.$(O) move.$(O) new_level.$(O) options.$(O) \ | |
37 outside.$(O) | |
38 OBJS2 = pack.$(O) passages.$(O) player.$(O) potions.$(O) rings.$(O) rip.$(O) \ | |
39 rogue.$(O) rooms.$(O) save.$(O) scrolls.$(O) state.$(O) sticks.$(O) \ | |
40 things.$(O) trader.$(O) util.$(O) vers.$(O) weapons.$(O) wear.$(O) \ | |
41 wizard.$(O) xcrypt.$(O) | |
42 OBJS = $(OBJS1) $(OBJS2) | |
43 CFILES= \ | |
44 vers.c chase.c command.c daemon.c daemons.c encumb.c \ | |
45 fight.c init.c io.c list.c main.c maze.c mdport.c misc.c monsters.c \ | |
46 move.c new_level.c options.c outside.c pack.c passages.c player.c \ | |
47 potions.c rings.c rip.c rogue.c \ | |
48 rooms.c save.c scrolls.c state.c sticks.c things.c trader.c util.c \ | |
49 weapons.c wear.c wizard.c xcrypt.c | |
50 | |
51 MISC= Makefile LICENSE.TXT arogue58.sln arogue58.vcproj | |
52 DOCS= arogue58.doc arogue58.html | |
53 | |
231 | 54 CC = @CC@ |
99 | 55 CPPFLAGS =@DEFS@ |
116
97f8fdf9595c
Makefiles: don't set defaults for CFLAGS.
John "Elwin" Edwards
parents:
104
diff
changeset
|
56 CFLAGS= |
222 | 57 CRLIB = @LIBS@ |
99 | 58 RM = rm -f |
59 TAR = tar | |
60 INSTALL=@INSTALL@ | |
232
bac2c81fec78
Makefiles: don't rely on built-in implicit rules.
John "Elwin" Edwards
parents:
231
diff
changeset
|
61 .SUFFIXES: .obj .o .c |
99 | 62 |
63 .c.obj: | |
64 $(CC) $(CFLAGS) /c $*.c | |
65 | |
232
bac2c81fec78
Makefiles: don't rely on built-in implicit rules.
John "Elwin" Edwards
parents:
231
diff
changeset
|
66 .c.o: |
bac2c81fec78
Makefiles: don't rely on built-in implicit rules.
John "Elwin" Edwards
parents:
231
diff
changeset
|
67 $(CC) $(CPPFLAGS) $(CFLAGS) -c $*.c |
bac2c81fec78
Makefiles: don't rely on built-in implicit rules.
John "Elwin" Edwards
parents:
231
diff
changeset
|
68 |
99 | 69 $(PROGRAM): $(OBJS) |
70 $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(CRLIB) -o $@ | |
71 | |
72 tags: $(HDRS) $(CFILES) | |
73 ctags -u $? | |
74 ed - tags < :ctfix | |
75 sort tags -o tags | |
76 | |
77 lint: | |
78 lint -hxbc $(CFILES) $(CRLIB) > linterrs | |
79 | |
80 install: $(PROGRAM) | |
224
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
81 touch test |
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
82 if test ! -f $(DESTDIR)$(SCOREFILE) ; then \ |
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
83 mkdir -p `dirname $(DESTDIR)$(SCOREFILE)` ; \ |
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
84 $(INSTALL) -m 0664 test $(DESTDIR)$(SCOREFILE) ; fi |
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
85 if test "x$(LOGFILE)" != "x" && test ! -f $(DESTDIR)$(LOGFILE) ; then \ |
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
86 mkdir -p `dirname $(DESTDIR)$(LOGFILE)` ; \ |
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
87 $(INSTALL) -m 0664 test $(DESTDIR)$(LOGFILE) ; fi |
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
88 if test "x$(SAVEDIR)" != "x" && test ! -d $(DESTDIR)$(SAVEDIR) ; then \ |
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
89 mkdir -p $(DESTDIR)$(SAVEDIR) ; fi |
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
90 mkdir -p $(DESTDIR)$(bindir) |
4d0f53998e8a
Makefile fixes related to installation.
John "Elwin" Edwards
parents:
222
diff
changeset
|
91 $(INSTALL) -m 0755 $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM) |
99 | 92 |