(info, html): Implement.
(all): Depend on info. Flatten info directory. This undoes the move to one subdirectory per chapter, which was done during Empire 2. The structure doesn't buy us much, as the info name space is flat, and it complicates makefiles. Overhaul info.pl: - It now wants to run in the root of the build tree. - Information on source files and subjects is now stored in makefiles, thus info.pl no longer picks up random junk from the file system. - Clean up Perl anachronisms, in particular use subroutine arguments and results rather than global variables where convenient. - Change format of diagnostics to the common format used by GNU tools, so that Emacs and the like can parse it. - Catch missing .SA. - When creating a new subject file, cowardly refuse to overwrite an existing file. - Subject files contain topics sorted by chapter, then by name. The order of chapters used to depend on how Perl sorts hash keys. Fix it.
This commit is contained in:
parent
641879abc7
commit
4ea4a01fd5
258 changed files with 318 additions and 239 deletions
|
@ -14,3 +14,4 @@ lib
|
||||||
sources.mk
|
sources.mk
|
||||||
stamp-h
|
stamp-h
|
||||||
stamp-h.in
|
stamp-h.in
|
||||||
|
subjects.mk
|
||||||
|
|
64
Make.mk
64
Make.mk
|
@ -46,9 +46,15 @@
|
||||||
-include sources.mk
|
-include sources.mk
|
||||||
dirs := $(sort $(dir $(src)))
|
dirs := $(sort $(dir $(src)))
|
||||||
csrc := $(filter %.c, $(src))
|
csrc := $(filter %.c, $(src))
|
||||||
|
tsrc := $(filter %.t, $(src))
|
||||||
|
|
||||||
|
# Info topics and subjects
|
||||||
|
-include subjects.mk
|
||||||
|
topics := $(patsubst %.t,%,$(notdir $(tsrc)))
|
||||||
|
info := $(topics) $(subjects) all
|
||||||
|
|
||||||
# Generated files
|
# Generated files
|
||||||
mk := sources.mk
|
mk := sources.mk subjects.mk
|
||||||
ac := autom4te.cache config.h config.status config.log stamp-h \
|
ac := autom4te.cache config.h config.status config.log stamp-h \
|
||||||
$(basename $(filter %.in, $(src)))
|
$(basename $(filter %.in, $(src)))
|
||||||
obj := $(csrc:.c=.o) $(filter %.o, $(ac:.c=.o))
|
obj := $(csrc:.c=.o) $(filter %.o, $(ac:.c=.o))
|
||||||
|
@ -57,6 +63,12 @@ deps := $(obj:.o=.d)
|
||||||
libs := $(addprefix lib/, libcommon.a libgen.a libglobal.a)
|
libs := $(addprefix lib/, libcommon.a libgen.a libglobal.a)
|
||||||
util := $(addprefix src/util/, fairland files pconfig)
|
util := $(addprefix src/util/, fairland files pconfig)
|
||||||
progs := $(util) src/client/empire src/server/emp_server
|
progs := $(util) src/client/empire src/server/emp_server
|
||||||
|
tsubj := $(addprefix info/, $(addsuffix .t, $(subjects)))
|
||||||
|
ttop := info/TOP.t
|
||||||
|
info.nr := $(addprefix info.nr/, $(info))
|
||||||
|
subjects.html := $(addprefix info.html/, $(addsuffix .html, $(subjects)))
|
||||||
|
topics.html := $(addprefix info.html/, $(addsuffix .html, $(topics)))
|
||||||
|
info.html := $(addprefix info.html/, $(addsuffix .html, $(info)))
|
||||||
|
|
||||||
ifeq ($(empthread),POSIX)
|
ifeq ($(empthread),POSIX)
|
||||||
empth_obj := src/lib/empthread/pthread.o
|
empth_obj := src/lib/empthread/pthread.o
|
||||||
|
@ -68,8 +80,9 @@ endif
|
||||||
|
|
||||||
# Abbreviations
|
# Abbreviations
|
||||||
scripts = $(srcdir)/src/scripts
|
scripts = $(srcdir)/src/scripts
|
||||||
clean := $(obj) $(deps) $(libs) $(progs) $(empth_lib)
|
clean := $(obj) $(deps) $(libs) $(progs) $(empth_lib) $(tsubj) \
|
||||||
distclean := $(ac)
|
$(info.nr) $(info.html)
|
||||||
|
distclean := $(ac) info/stamp $(ttop)
|
||||||
|
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
CPPFLAGS += -I$(srcdir)/include -Iinclude
|
CPPFLAGS += -I$(srcdir)/include -Iinclude
|
||||||
|
@ -83,11 +96,11 @@ LDLIBS += -lm
|
||||||
### Advertized goals
|
### Advertized goals
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(progs) # FIXME info
|
all: $(progs) info
|
||||||
|
|
||||||
.PHONY: info html
|
.PHONY: info html
|
||||||
info html:
|
info: $(info.nr)
|
||||||
false # FIXME
|
html: $(info.html)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
@ -129,6 +142,13 @@ endif
|
||||||
# automatic dependency generation
|
# automatic dependency generation
|
||||||
%: %.c
|
%: %.c
|
||||||
|
|
||||||
|
info.nr/%: info/%.t
|
||||||
|
$(NROFF) -I $(srcdir)/info $(filter %/CRT.MAC, $^) $< | $(AWK) -f $(filter %/Blank.awk, $^) >$@
|
||||||
|
# FIXME AT&T nroff doesn't grok -I
|
||||||
|
|
||||||
|
info.html/%.html: info/%.t
|
||||||
|
perl $(filter %.pl, $^) $< >$@
|
||||||
|
|
||||||
|
|
||||||
### Explicit rules
|
### Explicit rules
|
||||||
|
|
||||||
|
@ -149,7 +169,37 @@ $(libs) $(empth_lib): | lib
|
||||||
$(AR) rc $@ $?
|
$(AR) rc $@ $?
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
lib:
|
# info.pl reads $(tsrc) and writes subjects.mk $(ttop) $(tsubj). The
|
||||||
|
# naive rule
|
||||||
|
# subjects.mk $(ttop) $(tsubj): $(tsrc)
|
||||||
|
# COMMAND
|
||||||
|
# runs COMMAND once for each target. That's because multiple targets
|
||||||
|
# in an explicit rule is just a shorthand for one rule per target,
|
||||||
|
# each with the same prerequisites and commands. A pattern rule with
|
||||||
|
# multiple targets does what we want. So we artificially turn the
|
||||||
|
# explicit rule into a pattern rule: we replace info with %, and
|
||||||
|
# insert a touch target info/stamp.
|
||||||
|
$(patsubst info/%, \%/%, $(ttop) $(tsubj)): %/stamp
|
||||||
|
perl $(srcdir)/info/info.pl
|
||||||
|
info/stamp: $(tsrc) info/info.pl
|
||||||
|
>$@
|
||||||
|
subjects.mk: $(ttop)
|
||||||
|
:
|
||||||
|
|
||||||
|
info.nr/all: $(filter-out info.nr/all, $(info.nr))
|
||||||
|
(cd info.nr && ls -CF) >$@
|
||||||
|
# FIXME should use $^ and not ls
|
||||||
|
|
||||||
|
info.html/all.html: $(filter-out info.html/all.html, $(info.html)) info/ls2html.pl
|
||||||
|
(cd info.html && ls -CF *.html) | expand | perl $(filter %.pl, $^) >$@
|
||||||
|
# FIXME should use $^ and not ls
|
||||||
|
|
||||||
|
$(info.nr): info/CRT.MAC info/INFO.MAC info/Blank.awk | info.nr
|
||||||
|
|
||||||
|
$(subjects.html): info/subj2html.pl | info.html
|
||||||
|
$(topics.html): info/emp2html.pl | info.html
|
||||||
|
|
||||||
|
info.nr info.html lib:
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
ifeq ($(cvs_controlled),yes)
|
ifeq ($(cvs_controlled),yes)
|
||||||
|
|
27
info/.cvsignore
Normal file
27
info/.cvsignore
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
Combat.t
|
||||||
|
Commerce.t
|
||||||
|
Commodities.t
|
||||||
|
Communication.t
|
||||||
|
Deity.t
|
||||||
|
Detection.t
|
||||||
|
Diplomacy.t
|
||||||
|
Distribution.t
|
||||||
|
Introduction.t
|
||||||
|
LandUnits.t
|
||||||
|
Loans.t
|
||||||
|
Maps.t
|
||||||
|
Missions.t
|
||||||
|
Nations.t
|
||||||
|
Obsolete.t
|
||||||
|
Occupation.t
|
||||||
|
Planes.t
|
||||||
|
Playing.t
|
||||||
|
Populace.t
|
||||||
|
Producing.t
|
||||||
|
Sectors.t
|
||||||
|
Server.t
|
||||||
|
Ships.t
|
||||||
|
TOP.t
|
||||||
|
Transportation.t
|
||||||
|
Updates.t
|
||||||
|
stamp
|
|
@ -30,4 +30,4 @@
|
||||||
.ev 2
|
.ev 2
|
||||||
.ll 7.8i \" Line length: 7.8 inches
|
.ll 7.8i \" Line length: 7.8 inches
|
||||||
.ev
|
.ev
|
||||||
.so ../INFO.MAC \" Read in INFO.MAC macros
|
.so INFO.MAC \" Read in INFO.MAC macros
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue