summaryrefslogtreecommitdiff
blob: 95e01e53e1f7951edd8197ee7105882f4b636600 (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
From e0b8a7e0a9e0ee8c5983b94b849a8a69a5592464 Mon Sep 17 00:00:00 2001
From: Jonathan Dowland <jon@dow.land>
Date: Mon, 27 Nov 2017 21:17:55 +0000
Subject: [PATCH] overhaul manpages, add parameters

This is in order to better support derivative engines.

Rework the manpages to be parameterized with @PROGRAM_PREFIX@ and
@PACKAGE_NAME@. Alter the `docgen` generator to substitute those
parameters. Supply those parameters via the autofoo Makefile.

Adjust the fixed path chocolate-server.6 to be generated from
server.template, similar to doom.template -> chocolate-doom.6.

Further work is required, not least renaming chocolate-setup.6,
but several further parameterizations.
---
 man/Makefile.am                             | 68 ++++++++++++++-------
 man/bash-completion/Makefile.am             | 13 ++--
 man/chocolate-setup.6                       | 22 +++----
 man/default.cfg.template                    | 18 +++---
 man/docgen                                  | 32 ++++++----
 man/doom.template                           | 30 ++++-----
 man/extra.cfg.template                      | 24 ++++----
 man/heretic.template                        | 20 +++---
 man/hexen.template                          | 20 +++---
 man/{chocolate-server.6 => server.template} | 20 +++---
 man/strife.template                         | 18 +++---
 11 files changed, 161 insertions(+), 124 deletions(-)
 rename man/{chocolate-server.6 => server.template} (74%)

diff --git a/man/Makefile.am b/man/Makefile.am
index cfd2dc66..5916edf9 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -29,7 +29,8 @@ GENERATED_MAN_PAGES =               \
            @PROGRAM_PREFIX@hexen.cfg.5    \
            @PROGRAM_PREFIX@strife.6       \
            strife.cfg.5             \
-           @PROGRAM_PREFIX@strife.cfg.5
+           @PROGRAM_PREFIX@strife.cfg.5   \
+           @PROGRAM_PREFIX@server.6
 
 SETUP_MAN_PAGES =                          \
            @PROGRAM_PREFIX@doom-setup.6    \
@@ -37,8 +38,7 @@ SETUP_MAN_PAGES =                          \
            @PROGRAM_PREFIX@hexen-setup.6   \
            @PROGRAM_PREFIX@strife-setup.6
 
-man_MANS = chocolate-server.6             \
-           chocolate-setup.6              \
+man_MANS = chocolate-setup.6              \
            $(GENERATED_MAN_PAGES)         \
            $(SETUP_MAN_PAGES)
 
@@ -51,24 +51,29 @@ CLEANFILES = $(GENERATED_MAN_PAGES) $(SETUP_MAN_PAGES) \
              $(doomdocs_DATA) $(hereticdocs_DATA) \
              $(hexendocs_DATA) $(strifedocs_DATA)
 DOCGEN = $(srcdir)/docgen
+DOCGEN_COMMON_ARGS = -n "@PROGRAM_SPREFIX@" -s "@PACKAGE_NAME@"
 
 $(SETUP_MAN_PAGES): chocolate-setup.6
 	cp $(srcdir)/chocolate-setup.6 $@
 
 @PROGRAM_PREFIX@doom.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES)
-	$(DOCGEN) -g doom -m $(srcdir)/doom.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g doom -m $(srcdir)/doom.template \
                   $(top_srcdir)/src $(top_srcdir)/src/doom > $@
 
 default.cfg.5: $(top_srcdir)/src $(srcdir)/default.cfg.template
-	$(DOCGEN) -g doom -m $(srcdir)/default.cfg.template \
-                 -c default $(top_srcdir)/src/m_config.c > $@
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g doom -m $(srcdir)/default.cfg.template \
+                  -c default $(top_srcdir)/src/m_config.c > $@
 
 @PROGRAM_PREFIX@doom.cfg.5: $(top_srcdir)/src extra.cfg.template
-	$(DOCGEN) -g doom -m $(srcdir)/extra.cfg.template \
-                 -c extended $(top_srcdir)/src/m_config.c > $@
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g doom -m $(srcdir)/extra.cfg.template \
+                  -c extended $(top_srcdir)/src/m_config.c > $@
 
 CMDLINE.doom : CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/doom
-	$(DOCGEN) -p $(srcdir)/CMDLINE.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -p $(srcdir)/CMDLINE.template \
                   $(top_srcdir)/src/ $(top_srcdir)/src/doom/ > $@
 
 INSTALL.doom: INSTALL.template
@@ -76,19 +81,23 @@ INSTALL.doom: INSTALL.template
 
 
 @PROGRAM_PREFIX@heretic.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES) heretic.template
-	$(DOCGEN) -g heretic -m $(srcdir)/heretic.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                 -g heretic -m $(srcdir)/heretic.template \
                   $(top_srcdir)/src $(top_srcdir)/src/heretic > $@
 
 heretic.cfg.5: $(top_srcdir)/src $(srcdir)/default.cfg.template
-	$(DOCGEN) -g heretic -m $(srcdir)/default.cfg.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                 -g heretic -m $(srcdir)/default.cfg.template \
                   -c default $(top_srcdir)/src/m_config.c > $@
 
 @PROGRAM_PREFIX@heretic.cfg.5: $(top_srcdir)/src extra.cfg.template
-	$(DOCGEN) -g heretic -m $(srcdir)/extra.cfg.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                 -g heretic -m $(srcdir)/extra.cfg.template \
                  -c extended $(top_srcdir)/src/m_config.c > $@
 
 CMDLINE.heretic : CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/heretic
-	$(DOCGEN) -p $(srcdir)/CMDLINE.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                 -p $(srcdir)/CMDLINE.template \
                   $(top_srcdir)/src/ $(top_srcdir)/src/heretic/ > $@
 
 INSTALL.heretic: INSTALL.template
@@ -96,19 +105,23 @@ INSTALL.heretic: INSTALL.template
 
 
 @PROGRAM_PREFIX@hexen.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES)
-	$(DOCGEN) -g hexen -m $(srcdir)/hexen.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                 -g hexen -m $(srcdir)/hexen.template \
                   $(top_srcdir)/src $(top_srcdir)/src/hexen > $@
 
 hexen.cfg.5: $(top_srcdir)/src default.cfg.template
-	$(DOCGEN) -g hexen -m $(srcdir)/default.cfg.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                 -g hexen -m $(srcdir)/default.cfg.template \
                  -c default $(top_srcdir)/src/m_config.c > $@
 
 @PROGRAM_PREFIX@hexen.cfg.5: $(top_srcdir)/src extra.cfg.template
-	$(DOCGEN) -g hexen -m $(srcdir)/extra.cfg.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                 -g hexen -m $(srcdir)/extra.cfg.template \
                  -c extended $(top_srcdir)/src/m_config.c > $@
 
 CMDLINE.hexen : CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/hexen
-	$(DOCGEN) -p $(srcdir)/CMDLINE.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -p $(srcdir)/CMDLINE.template \
                   $(top_srcdir)/src/ $(top_srcdir)/src/hexen/ > $@
 
 INSTALL.hexen: INSTALL.template
@@ -116,19 +129,28 @@ INSTALL.hexen: INSTALL.template
 
 
 @PROGRAM_PREFIX@strife.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES)
-	$(DOCGEN) -g strife -m $(srcdir)/strife.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g strife -m $(srcdir)/strife.template \
                   $(top_srcdir)/src $(top_srcdir)/src/strife > $@
 
+@PROGRAM_PREFIX@server.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES)
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g server -m $(srcdir)/server.template \
+                  $(top_srcdir)/src > $@
+
 strife.cfg.5: $(top_srcdir)/src default.cfg.template
-	$(DOCGEN) -g strife -m $(srcdir)/default.cfg.template \
-                 -c default $(top_srcdir)/src/m_config.c > $@
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g strife -m $(srcdir)/default.cfg.template \
+                  -c default $(top_srcdir)/src/m_config.c > $@
 
 @PROGRAM_PREFIX@strife.cfg.5: $(top_srcdir)/src extra.cfg.template
-	$(DOCGEN) -g strife -m $(srcdir)/extra.cfg.template \
-                 -c extended $(top_srcdir)/src/m_config.c > $@
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g strife -m $(srcdir)/extra.cfg.template \
+                  -c extended $(top_srcdir)/src/m_config.c > $@
 
 CMDLINE.strife : CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/strife
-	$(DOCGEN) -p $(srcdir)/CMDLINE.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -p $(srcdir)/CMDLINE.template \
                   $(top_srcdir)/src/ $(top_srcdir)/src/strife/ > $@
 
 INSTALL.strife: INSTALL.template
diff --git a/man/bash-completion/Makefile.am b/man/bash-completion/Makefile.am
index 2c036acf..801dd212 100644
--- a/man/bash-completion/Makefile.am
+++ b/man/bash-completion/Makefile.am
@@ -19,21 +19,26 @@ CLEANFILES = $(BASH_COMPLETION_SCRIPTLETS)
 
 MANDIR = $(top_srcdir)/man
 DOCGEN = $(MANDIR)/docgen
+DOCGEN_COMMON_ARGS = -n "@PROGRAM_SPREFIX@" -s "@PACKAGE_NAME@"
 
 @PROGRAM_PREFIX@doom: $(top_srcdir)/src $(DOCGEN) $(BASH_COMPLETION_TEMPLATES)
-	$(DOCGEN) -g doom -b $(MANDIR)/doom.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g doom -b $(MANDIR)/doom.template \
                   $(top_srcdir)/src $(top_srcdir)/src/doom > $@
 
 @PROGRAM_PREFIX@heretic: $(top_srcdir)/src $(DOCGEN) $(BASH_COMPLETION_TEMPLATES)
-	$(DOCGEN) -g heretic -b $(MANDIR)/heretic.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g heretic -b $(MANDIR)/heretic.template \
                   $(top_srcdir)/src $(top_srcdir)/src/heretic > $@
 
 @PROGRAM_PREFIX@hexen: $(top_srcdir)/src $(DOCGEN) $(BASH_COMPLETION_TEMPLATES)
-	$(DOCGEN) -g hexen -b $(MANDIR)/hexen.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g hexen -b $(MANDIR)/hexen.template \
                   $(top_srcdir)/src $(top_srcdir)/src/hexen > $@
 
 @PROGRAM_PREFIX@strife: $(top_srcdir)/src $(DOCGEN) $(BASH_COMPLETION_TEMPLATES)
-	$(DOCGEN) -g strife -b $(MANDIR)/strife.template \
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g strife -b $(MANDIR)/strife.template \
                   $(top_srcdir)/src $(top_srcdir)/src/strife > $@
 
 EXTRA_DIST = \
diff --git a/man/chocolate-setup.6 b/man/chocolate-setup.6
index 21c9d5d4..64f65937 100644
--- a/man/chocolate-setup.6
+++ b/man/chocolate-setup.6
@@ -1,20 +1,20 @@
-.TH chocolate\-setup 6
+.TH @PROGRAM_SPREFIX@\-setup 6
 .SH NAME
-chocolate\-setup \- configuration tool for chocolate\-doom
+@PROGRAM_SPREFIX@\-setup \- configuration tool for @PROGRAM_SPREFIX@\-doom
 .SH SYNOPSIS
-.B chocolate\-setup
+.B @PROGRAM_SPREFIX@\-setup
 [OPTIONS]
 .SH DESCRIPTION
 .PP
-Chocolate Doom is a modern Doom engine designed to behave
+@PACKAGE_NAME@ is a modern Doom engine designed to behave
 as similar to the original Doom game as is possible.
 .PP
-.B chocolate\-setup
-is a tool for configuring Chocolate Doom. It provides a menu\-based
+.B @PROGRAM_SPREFIX@\-setup
+is a tool for configuring @PACKAGE_NAME@. It provides a menu\-based
 interface for the display, joystick, keyboard, mouse, sound and
 compatibility settings.
 .PP
-.B chocolate\-setup
+.B @PROGRAM_SPREFIX@\-setup
 can also be used to start and join network games.
 .PP
 .SH OPTIONS
@@ -23,15 +23,15 @@ can also be used to start and join network games.
 Load configuration from the specified file, instead of default.cfg. 
 .TP
 \fB-extraconfig <file>\fR
-Load extra configuration from the specified file, instead of chocolate-doom.cfg. 
+Load extra configuration from the specified file, instead of @PROGRAM_SPREFIX@\-doom.cfg. 
 .SH SEE ALSO
-\fBchocolate-doom\fR(6),
+\fB@CHOCOLATE_SPREFIX@\-doom\fR(6),
 \fBdefault.cfg\fR(5),
-\fBchocolate-doom.cfg\fR(5)
+\fB@CHOCOLATE_SPREFIX@\-doom.cfg\fR(5)
 .SH AUTHOR
 Chocolate Doom is written and maintained by Simon Howard.
 .PP
-This manual was written by Jon Dowland.
+This manual was written by Jonathan Dowland.
 .SH COPYRIGHT
 Copyright \(co id Software Inc.
 Copyright \(co 2005-8 Simon Howard.
diff --git a/man/default.cfg.template b/man/default.cfg.template
index 5cf6256f..70c0d657 100644
--- a/man/default.cfg.template
+++ b/man/default.cfg.template
@@ -1,21 +1,21 @@
 .TH default.cfg 5
 .SH NAME
-default.cfg \- Chocolate Doom configuration file
+default.cfg \- @PACKAGE_NAME@ configuration file
 .SH DESCRIPTION
 .PP
 \fIdefault.cfg\fR
-is the configuration file for \fBchocolate-doom\fR(6).  The configuration
+is the configuration file for \fB@PROGRAM_SPREFIX@\-doom\fR(6).  The configuration
 options stored in the file are the same as those stored in the
 original DOS Vanilla Doom. 
-Extra Chocolate Doom-specific options are stored in a separate 
-configuration file, \fBchocolate-doom.cfg\fR.
+Extra @PACKAGE_NAME@-specific options are stored in a separate 
+configuration file, \fB@PROGRAM_SPREFIX@\-doom.cfg\fR.
 .PP
 \fIdefault.cfg\fR is normally stored in the user's home directory,
-as \fI~/.local/share/chocolate-doom/default.cfg\fR.  The path can be
+as \fI~/.local/share/@PROGRAM_SPREFIX@\-doom/default.cfg\fR.  The path can be
 overridden using the \fBXDG_DATA_HOME\fR environment variable (see the XDG
 Base Directory Specification).
 .PP
-The \fBchocolate-setup\fR(6) tool provides a simple to use front-end
+The \fB@PROGRAM_SPREFIX@\-setup\fR(6) tool provides a simple to use front-end
 for editing \fIdefault.cfg\fR.
 .br
 .SH FILE FORMAT
@@ -49,7 +49,7 @@ indicating "false" and a non-zero value indicating "true".
 @content
 
 .SH SEE ALSO
-\fBchocolate-doom\fR(6),
-\fBchocolate-doom.cfg\fR(5),
-\fBchocolate-setup\fR(6)
+\fB@PROGRAM_SPREFIX@\-doom\fR(6),
+\fB@PROGRAM_SPREFIX@\-doom.cfg\fR(5),
+\fB@PROGRAM_SPREFIX@\-setup\fR(6)
 
diff --git a/man/docgen b/man/docgen
index e477e74e..defb9060 100755
--- a/man/docgen
+++ b/man/docgen
@@ -430,7 +430,7 @@ def process_files(path):
 
         process_file(path)
 
-def print_template(template_file, content):
+def print_template(template_file, program_prefix, package_name, content):
     f = io.open(template_file, encoding='UTF-8')
 
     try:
@@ -440,14 +440,16 @@ def print_template(template_file, content):
                 filename = match.group(1)
                 filename = os.path.join(os.path.dirname(template_file),
                                         filename)
-                print_template(filename, content)
+                print_template(filename, program_prefix, package_name, content)
             else:
                 line = line.replace("@content", content)
+                line = line.replace("@PROGRAM_SPREFIX@", program_prefix)
+                line = line.replace("@PACKAGE_SHORTNAME@", package_name)
                 stdout(line.rstrip().encode('UTF-8') + b'\n')
     finally:
         f.close()
 
-def manpage_output(targets, template_file):
+def manpage_output(targets, program_prefix, package_name, template_file):
 
     content = ""
 
@@ -456,7 +458,7 @@ def manpage_output(targets, template_file):
 
     content = content.replace("-", "\\-")
 
-    print_template(template_file, content)
+    print_template(template_file, program_prefix, package_name, content)
 
 def wiki_output(targets, template):
     read_wikipages()
@@ -464,29 +466,31 @@ def wiki_output(targets, template):
     for t in targets:
         stdout(t.wiki_output().encode('UTF-8') + b'\n')
 
-def plaintext_output(targets, template_file):
+def plaintext_output(targets, program_prefix, package_name, template_file):
 
     content = ""
 
     for t in targets:
         content += t.plaintext_output() + "\n"
 
-    print_template(template_file, content)
+    print_template(template_file, program_prefix, package_name, content)
 
-def completion_output(targets, template_file):
+def completion_output(targets, program_prefix, package_name, template_file):
 
     content = ""
 
     for t in targets:
         content += t.completion_output() + "\n"
 
-    print_template(template_file, content)
+    print_template(template_file, program_prefix, package_name, content)
 
 def usage():
-    print("Usage: %s [-V] [-c tag] [-g game] ( -m | -w | -p ) <dir>..." \
+    print("Usage: %s [-V] [-c tag] [-g game] -n name ( -m | -w | -p ) <dir>..." \
             % sys.argv[0])
     print("   -c :  Provide documentation for the specified configuration file")
     print("         (matches the given tag name in the source file)")
+    print("   -s :  Package name (for substitution)")
+    print("   -n :  Program name (for substitution)")
     print("   -m :  Manpage output")
     print("   -w :  Wikitext output")
     print("   -p :  Plaintext output")
@@ -497,14 +501,20 @@ def usage():
 
 # Parse command line
 
-opts, args = getopt.getopt(sys.argv[1:], "m:wp:b:c:g:V")
+opts, args = getopt.getopt(sys.argv[1:], "n:s:m:wp:b:c:g:V")
 
 output_function = None
 template = None
 doc_config_file = None
 match_game = None
+program_prefix = None
+package_name = None
 
 for opt in opts:
+    if opt[0] == "-n":
+        program_prefix = opt[1]
+    if opt[0] == "-s":
+        package_name = opt[1]
     if opt[0] == "-m":
         output_function = manpage_output
         template = opt[1]
@@ -546,5 +556,5 @@ else:
 
     # Generate the output
 
-    output_function(documentation_targets, template)
+    output_function(documentation_targets, program_prefix, package_name, template)
 
diff --git a/man/doom.template b/man/doom.template
index 845147a8..da8d2141 100644
--- a/man/doom.template
+++ b/man/doom.template
@@ -1,35 +1,35 @@
-.TH chocolate\-doom 6
+.TH @PROGRAM_SPREFIX@\-doom 6
 .SH NAME
-chocolate\-doom \- historically compatible Doom engine
+@PROGRAM_SPREFIX@\-doom \- historically compatible Doom engine
 .SH SYNOPSIS
-.B chocolate\-doom
+.B @PROGRAM_SPREFIX@\-doom
 [\fIOPTIONS\fR]
 .SH DESCRIPTION
 .PP
-Chocolate Doom is a port of Id Software's 1993 game "Doom" that is designed
+@PACKAGE_NAME@ is a port of Id Software's 1993 game "Doom" that is designed
 to behave as similar to the original DOS version of Doom as is possible.
 .br
 @content
 .SH IWAD SEARCH PATHS
 @include iwad_paths.man
 .SH ENVIRONMENT
-This section describes environment variables that control Chocolate Doom's
+This section describes environment variables that control @PACKAGE_NAME@'s
 behavior.
 @include environ.man
 .SH FILES
 .TP
-\fB$HOME/.local/share/chocolate-doom/default.cfg\fR
-The main configuration file for Chocolate Doom.  See \fBdefault.cfg\fR(5).
+\fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/default.cfg\fR
+The main configuration file for @PACKAGE_NAME@.  See \fBdefault.cfg\fR(5).
 .TP
-\fB$HOME/.local/share/chocolate-doom/chocolate-doom.cfg\fR
-Extra configuration values that are specific to Chocolate Doom and not
-present in Vanilla Doom.  See \fBchocolate-doom.cfg\fR(5).
+\fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/@PROGRAM_SPREFIX@\-doom.cfg\fR
+Extra configuration values that are specific to @PACKAGE_NAME@ and not
+present in Vanilla Doom.  See \fB@PROGRAM_SPREFIX@\-doom.cfg\fR(5).
 .SH SEE ALSO
-\fBchocolate-server\fR(6),
-\fBchocolate-setup\fR(6),
-\fBchocolate-heretic\fR(6),
-\fBchocolate-hexen\fR(6),
-\fBchocolate-strife\fR(6)
+\fB@PROGRAM_SPREFIX@\-server\fR(6),
+\fB@PROGRAM_SPREFIX@\-setup\fR(6),
+\fB@PROGRAM_SPREFIX@\-heretic\fR(6),
+\fB@PROGRAM_SPREFIX@\-hexen\fR(6),
+\fB@PROGRAM_SPREFIX@\-strife\fR(6)
 .SH AUTHOR
 Chocolate Doom is written and maintained by Simon Howard.  It is based on
 the LinuxDoom source code, released by Id Software.
diff --git a/man/extra.cfg.template b/man/extra.cfg.template
index b9317c53..77cc0dd3 100644
--- a/man/extra.cfg.template
+++ b/man/extra.cfg.template
@@ -1,23 +1,23 @@
-.TH chocolate-doom.cfg 5
+.TH @PROGRAM_SPREFIX@\-doom.cfg 5
 .SH NAME
-chocolate-doom.cfg \- Chocolate Doom configuration file
+@PROGRAM_SPREFIX@\-doom.cfg \- @PACKAGE_NAME@ configuration file
 .SH DESCRIPTION
 .PP
-\fIchocolate-doom.cfg\fR
-is a configuration file for \fBchocolate-doom\fR(6).  This file acts
+\fI@PROGRAM_SPREFIX@\-doom.cfg\fR
+is a configuration file for \fB@PROGRAM_SPREFIX@\-doom\fR(6).  This file acts
 as an auxiliary configuration file; the main configuration options
 are stored in \fBdefault.cfg\fR, which contains the same configuration
-options as Vanilla Doom (for compatibility).  \fIchocolate-doom.cfg\fR
-contains configuration options that are specific to Chocolate Doom
+options as Vanilla Doom (for compatibility).  \fI@PROGRAM_SPREFIX@\-doom.cfg\fR
+contains configuration options that are specific to @PACKAGE_NAME@
 only.
 .PP
-\fIchocolate-doom.cfg\fR is normally stored in the user's home directory,
-as \fI~/.local/share/chocolate-doom/chocolate-doom.cfg\fR.  The path can be
+\fI@PROGRAM_SPREFIX@\-doom.cfg\fR is normally stored in the user's home directory,
+as \fI~/.local/share/@PROGRAM_SPREFIX@\-doom/@PROGRAM_SPREFIX@\-doom.cfg\fR.  The path can be
 overridden using the \fBXDG_DATA_HOME\fR environment variable (see the XDG
 Base Directory Specification).
 .PP
-The \fBchocolate-setup\fR(6) tool provides a simple to use front-end
-for editing \fIchocolate-doom.cfg\fR.
+The \fB@PROGRAM_SPREFIX@\-setup\fR(6) tool provides a simple to use front-end
+for editing \fI@PROGRAM_SPREFIX@\-doom.cfg\fR.
 .SH FILE FORMAT
 .PP
 The file format is the same as that used for \fBdefault.cfg\fR(5).
@@ -26,7 +26,7 @@ The file format is the same as that used for \fBdefault.cfg\fR(5).
 @content
 
 .SH SEE ALSO
-\fBchocolate-doom\fR(6),
+\fB@PROGRAM_SPREFIX@\-doom\fR(6),
 \fBdefault.cfg\fR(5),
-\fBchocolate-setup\fR(6)
+\fB@PROGRAM_SPREFIX@\-setup\fR(6)
 
diff --git a/man/heretic.template b/man/heretic.template
index 944d4a83..c078c7c6 100644
--- a/man/heretic.template
+++ b/man/heretic.template
@@ -1,8 +1,8 @@
-.TH chocolate\-heretic 6
+.TH @PROGRAM_SPREFIX@\-heretic 6
 .SH NAME
-chocolate\-heretic \- historically compatible Heretic engine
+@PROGRAM_SPREFIX@\-heretic \- historically compatible Heretic engine
 .SH SYNOPSIS
-.B chocolate\-heretic
+.B @PROGRAM_SPREFIX@\-heretic
 [\fIOPTIONS\fR]
 .SH DESCRIPTION
 .PP
@@ -19,17 +19,17 @@ behavior.
 @include environ.man
 .SH FILES
 .TP
-\fB$HOME/.local/share/chocolate-doom/heretic.cfg\fR
+\fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/heretic.cfg\fR
 The main configuration file for Chocolate Heretic.  See \fBheretic.cfg\fR(5).
 .TP
-\fB$HOME/.local/share/chocolate-doom/chocolate-heretic.cfg\fR
+\fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/@PROGRAM_SPREFIX@\-heretic.cfg\fR
 Extra configuration values that are specific to Chocolate Heretic and not
-present in Vanilla Heretic. See \fBchocolate-heretic.cfg\fR(5).
+present in Vanilla Heretic. See \fB@PROGRAM_SPREFIX@\-heretic.cfg\fR(5).
 .SH SEE ALSO
-\fBchocolate-doom\fR(6),
-\fBchocolate-hexen\fR(6),
-\fBchocolate-server\fR(6),
-\fBchocolate-setup\fR(6)
+\fB@PROGRAM_SPREFIX@\-doom\fR(6),
+\fB@PROGRAM_SPREFIX@\-hexen\fR(6),
+\fB@PROGRAM_SPREFIX@\-server\fR(6),
+\fB@PROGRAM_SPREFIX@\-setup\fR(6)
 .SH AUTHOR
 Chocolate Heretic is part of the Chocolate Doom project, written and
 maintained by Simon Howard. It is based on the Heretic source code,
diff --git a/man/hexen.template b/man/hexen.template
index 7772b1d4..9184a27e 100644
--- a/man/hexen.template
+++ b/man/hexen.template
@@ -1,8 +1,8 @@
-.TH chocolate\-hexen 6
+.TH @PROGRAM_SPREFIX@\-hexen 6
 .SH NAME
-chocolate\-hexen \- historically compatible Hexen engine
+@PROGRAM_SPREFIX@\-hexen \- historically compatible Hexen engine
 .SH SYNOPSIS
-.B chocolate\-hexen
+.B @PROGRAM_SPREFIX@\-hexen
 [\fIOPTIONS\fR]
 .SH DESCRIPTION
 .PP
@@ -19,17 +19,17 @@ behavior.
 @include environ.man
 .SH FILES
 .TP
-\fB$HOME/.local/share/chocolate-doom/hexen.cfg\fR
+\fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/hexen.cfg\fR
 The main configuration file for Chocolate Hexen.  See \fBhexen.cfg\fR(5).
 .TP
-\fB$HOME/.local/share/chocolate-doom/chocolate-hexen.cfg\fR
+\fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/@PROGRAM_SPREFIX@\-hexen.cfg\fR
 Extra configuration values that are specific to Chocolate Hexen and not
-present in Vanilla Hexen.  See \fBchocolate-hexen.cfg\fR(5).
+present in Vanilla Hexen.  See \fB@PROGRAM_SPREFIX@\-hexen.cfg\fR(5).
 .SH SEE ALSO
-\fBchocolate-doom\fR(6),
-\fBchocolate-heretic\fR(6),
-\fBchocolate-server\fR(6),
-\fBchocolate-setup\fR(6)
+\fB@PROGRAM_SPREFIX@\-doom\fR(6),
+\fB@PROGRAM_SPREFIX@\-heretic\fR(6),
+\fB@PROGRAM_SPREFIX@\-server\fR(6),
+\fB@PROGRAM_SPREFIX@\-setup\fR(6)
 .SH AUTHOR
 Chocolate Hexen is part of the Chocolate Doom project, written and
 maintained by Simon Howard. It is based on the Hexen source code,
diff --git a/man/chocolate-server.6 b/man/server.template
similarity index 74%
rename from man/chocolate-server.6
rename to man/server.template
index 74dc6f42..643779f6 100644
--- a/man/chocolate-server.6
+++ b/man/server.template
@@ -1,18 +1,18 @@
-.TH chocolate\-server 6
+.TH @PROGRAM_SPREFIX@\-server 6
 .SH NAME
-chocolate\-server \- dedicated server for chocolate\-doom
+@PROGRAM_SPREFIX@\-server \- dedicated server for @PROGRAM_SPREFIX@\-doom
 .SH SYNOPSIS
-.B chocolate\-server
+.B @PROGRAM_SPREFIX@\-server
 [OPTIONS]
 .SH DESCRIPTION
 .PP
-Chocolate Doom is a modern doom engine designed to behave
+@PACKAGE_SHORTNAME@ is a modern doom engine designed to behave
 as similar to the original doom game as is possible.
 .PP
-.B chocolate\-server
-is a dedicated server for Chocolate Doom. It is equivalent to 
+.B @PROGRAM_SPREFIX@\-server
+is a dedicated server for @PACKAGE_SHORTNAME@. It is equivalent to 
 running 
-.B chocolate\-doom
+.B @PROGRAM_SPREFIX@\-doom
 with the "\-dedicated" option.
 .PP
 Game options are not specified to the server, which merely acts to
@@ -36,12 +36,12 @@ Don't register with the global master server.
 \fB-servername <name>\fR
 Specify a name for the server.
 .SH SEE ALSO
-\fBchocolate-doom\fR(6),
-\fBchocolate-setup\fR(6)
+\fB@PROGRAM_SPREFIX@-doom\fR(6),
+\fB@PROGRAM_SPREFIX@-setup\fR(6)
 .SH AUTHOR
 Chocolate Doom is written and maintained by Simon Howard.
 .PP
-This manual was written by Jon Dowland.
+This manual was written by Jonathan Dowland.
 .SH COPYRIGHT
 Copyright \(co id Software Inc.
 Copyright \(co 2005-8 Simon Howard.
diff --git a/man/strife.template b/man/strife.template
index d616c17b..9ca7f14e 100644
--- a/man/strife.template
+++ b/man/strife.template
@@ -1,8 +1,8 @@
-.TH chocolate\-strife 6
+.TH @PROGRAM_SPREFIX@\-strife 6
 .SH NAME
-chocolate\-strife \- historically compatible strife engine
+@PROGRAM_SPREFIX@\-strife \- historically compatible Strife engine
 .SH SYNOPSIS
-.B chocolate\-strife
+.B @PROGRAM_SPREFIX@\-strife
 [\fIOPTIONS\fR]
 .SH DESCRIPTION
 .PP
@@ -22,16 +22,16 @@ behavior.
 
 .SH FILES
 .TP
-\fB$HOME/.local/share/chocolate-doom/strife.cfg\fR
+\fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/strife.cfg\fR
 The main configuration file for Chocolate Strife.  See \fBstrife.cfg\fR(5).
 .TP
-\fB$HOME/.local/share/chocolate-doom/chocolate-strife.cfg\fR
+\fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/@PROGRAM_SPREFIX@\-strife.cfg\fR
 Extra configuration values that are specific to Chocolate Strife and not
-present in Vanilla Strife.  See \fBchocolate-strife.cfg\fR(5).
+present in Vanilla Strife.  See \fB@PROGRAM_SPREFIX@\-strife.cfg\fR(5).
 .SH SEE ALSO
-\fBchocolate-doom\fR(6),
-\fBchocolate-server\fR(6),
-\fBchocolate-setup\fR(6)
+\fB@PROGRAM_SPREFIX@\-doom\fR(6),
+\fB@PROGRAM_SPREFIX@\-server\fR(6),
+\fB@PROGRAM_SPREFIX@\-setup\fR(6)
 
 .SH HISTORY
 The source code for Strife was lost, which means, unlike the code for all the
-- 
2.26.2