mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-04 04:25:46 -04:00
build: Fix 'make -j' handling.
Some build targets create multiple outputs, which can cause problems when doing parallel builds. Clean up the build system so that all subdir invocations come from the top-level Makefile and use $(MAKE). Also fix the FREEDOOM/FREEDM lumps to really include the version number by using $(shell ...) syntax.
This commit is contained in:
parent
d9b4c2530a
commit
d241e7f326
4 changed files with 44 additions and 51 deletions
32
Makefile
32
Makefile
|
@ -27,7 +27,7 @@
|
||||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
VERSION!=git describe
|
VERSION=$(shell git describe)
|
||||||
WADS=wads
|
WADS=wads
|
||||||
CPP=scripts/simplecpp
|
CPP=scripts/simplecpp
|
||||||
DEUTEX=deutex
|
DEUTEX=deutex
|
||||||
|
@ -43,14 +43,21 @@ OBJS=$(FREEDM) $(FREEDOOM1) $(FREEDOOM2)
|
||||||
all: $(OBJS)
|
all: $(OBJS)
|
||||||
|
|
||||||
subdirs:
|
subdirs:
|
||||||
make -C graphics/text
|
$(MAKE) -C graphics/text
|
||||||
make -C graphics/titlepic
|
$(MAKE) -C graphics/titlepic
|
||||||
make -C lumps
|
$(MAKE) -C lumps/cph/misc-lumps
|
||||||
|
$(MAKE) -C lumps/genmidi
|
||||||
|
$(MAKE) -C lumps/dmxgus
|
||||||
|
$(MAKE) -C lumps/textures
|
||||||
|
|
||||||
|
|
||||||
# this is a useless dependency to force builds
|
# this is a useless dependency to force builds
|
||||||
|
|
||||||
force:
|
force:
|
||||||
|
|
||||||
|
lumps/freedoom.lmp lumps/freedm.lmp: force
|
||||||
|
echo $(VERSION) > $@
|
||||||
|
|
||||||
pnames.txt:
|
pnames.txt:
|
||||||
scripts/extract-pnames.py -a > $@
|
scripts/extract-pnames.py -a > $@
|
||||||
|
|
||||||
|
@ -78,7 +85,7 @@ wadinfo_freedm.txt : buildcfg.txt force pnames.txt
|
||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
# freedm iwad
|
# freedm iwad
|
||||||
|
|
||||||
$(FREEDM): wadinfo_freedm.txt subdirs force
|
$(FREEDM): wadinfo_freedm.txt subdirs lumps/freedm.lmp
|
||||||
@mkdir -p $(WADS)
|
@mkdir -p $(WADS)
|
||||||
rm -f $@
|
rm -f $@
|
||||||
$(DEUTEX) $(DEUTEX_ARGS) -iwad -build wadinfo_freedm.txt $@
|
$(DEUTEX) $(DEUTEX_ARGS) -iwad -build wadinfo_freedm.txt $@
|
||||||
|
@ -86,7 +93,7 @@ $(FREEDM): wadinfo_freedm.txt subdirs force
|
||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
# phase 1 (udoom) iwad
|
# phase 1 (udoom) iwad
|
||||||
|
|
||||||
$(FREEDOOM1): wadinfo_phase1.txt subdirs force
|
$(FREEDOOM1): wadinfo_phase1.txt subdirs lumps/freedoom.lmp
|
||||||
@mkdir -p $(WADS)
|
@mkdir -p $(WADS)
|
||||||
rm -f $@
|
rm -f $@
|
||||||
$(DEUTEX) $(DEUTEX_ARGS) -iwad -lumps -patch -flats -sounds -musics -graphics -sprites -levels -build wadinfo_phase1.txt $@
|
$(DEUTEX) $(DEUTEX_ARGS) -iwad -lumps -patch -flats -sounds -musics -graphics -sprites -levels -build wadinfo_phase1.txt $@
|
||||||
|
@ -94,7 +101,7 @@ $(FREEDOOM1): wadinfo_phase1.txt subdirs force
|
||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
# phase 2 (doom2) iwad
|
# phase 2 (doom2) iwad
|
||||||
|
|
||||||
$(FREEDOOM2): wadinfo_phase2.txt subdirs force
|
$(FREEDOOM2): wadinfo_phase2.txt subdirs lumps/freedoom.lmp
|
||||||
@mkdir -p $(WADS)
|
@mkdir -p $(WADS)
|
||||||
rm -f $@
|
rm -f $@
|
||||||
$(DEUTEX) $(DEUTEX_ARGS) -iwad -lumps -patch -flats -sounds -musics -graphics -sprites -levels -build wadinfo_phase2.txt $@
|
$(DEUTEX) $(DEUTEX_ARGS) -iwad -lumps -patch -flats -sounds -musics -graphics -sprites -levels -build wadinfo_phase2.txt $@
|
||||||
|
@ -119,6 +126,11 @@ clean:
|
||||||
pnames.txt
|
pnames.txt
|
||||||
-rmdir $(WADS)
|
-rmdir $(WADS)
|
||||||
|
|
||||||
make -C lumps clean
|
$(MAKE) -C lumps clean
|
||||||
make -C graphics/text clean
|
$(MAKE) -C graphics/text clean
|
||||||
make -C graphics/titlepic clean
|
$(MAKE) -C graphics/titlepic clean
|
||||||
|
$(MAKE) -C lumps/cph/misc-lumps clean
|
||||||
|
$(MAKE) -C lumps/genmidi clean
|
||||||
|
$(MAKE) -C lumps/dmxgus clean
|
||||||
|
$(MAKE) -C lumps/textures clean
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,22 @@ GRAPHICS = \
|
||||||
|
|
||||||
all: $(GRAPHICS)
|
all: $(GRAPHICS)
|
||||||
|
|
||||||
$(GRAPHICS): config.py fontchars ../../lumps/fraggle/freedoom.bex
|
# textgen creates multiple outputs, which is awkward to express in
|
||||||
|
# make. Use a witness file (graphics.stamp) as suggested in the
|
||||||
|
# automake manual: "Handling Tools that Produce Many Outputs"
|
||||||
|
|
||||||
|
$(GRAPHICS): graphics.stamp
|
||||||
|
@if test -f $@; then :; else \
|
||||||
|
rm -f graphics.stamp; \
|
||||||
|
$(MAKE) data.stamp; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
graphics.stamp: config.py fontchars ../../lumps/fraggle/freedoom.bex
|
||||||
|
@rm -f graphics.tmp
|
||||||
|
@touch graphics.tmp
|
||||||
./textgen
|
./textgen
|
||||||
|
@mv graphics.tmp $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(GRAPHICS)
|
rm -f $(GRAPHICS) graphics.stamp
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
|
|
||||||
all : freedoom.lmp freedm.lmp misc-lumps genmidi-lump dmxgus.lmp \
|
|
||||||
fd1txtr1.lmp fd2txtr1.lmp fdmtxtr1.lmp
|
|
||||||
|
|
||||||
misc-lumps:
|
|
||||||
make -C cph/misc-lumps
|
|
||||||
|
|
||||||
genmidi-lump:
|
|
||||||
make -C genmidi
|
|
||||||
|
|
||||||
dmxgus.lmp:
|
|
||||||
make -C dmxgus
|
|
||||||
|
|
||||||
fd1txtr1.lmp fd2txtr1.lmp fdmtxtr1.lmp:
|
|
||||||
make -C textures
|
|
||||||
|
|
||||||
freedoom.lmp: force
|
|
||||||
echo $(VERSION) > freedoom.lmp
|
|
||||||
|
|
||||||
freedm.lmp: force
|
|
||||||
echo $(VERSION) > freedm.lmp
|
|
||||||
|
|
||||||
force:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
make -C cph/misc-lumps clean
|
|
||||||
make -C genmidi clean
|
|
||||||
make -C dmxgus clean
|
|
||||||
make -C textures clean
|
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
|
|
||||||
CPP=../../scripts/simplecpp
|
CPP=../../scripts/simplecpp
|
||||||
PHASE1_OUTPUTS = phase1/texture1.lmp phase1/texture2.lmp \
|
|
||||||
phase1/pnames.lmp
|
|
||||||
PHASE2_OUTPUTS = phase2/texture1.lmp phase2/pnames.lmp
|
|
||||||
FREEDM_OUTPUTS = freedm/texture1.lmp freedm/pnames.lmp
|
|
||||||
|
|
||||||
all: $(PHASE1_OUTPUTS) $(PHASE2_OUTPUTS) $(FREEDM_OUTPUTS)
|
all: phase1/texture1.lmp phase2/texture1.lmp freedm/texture1.lmp
|
||||||
|
|
||||||
$(PHASE1_OUTPUTS): textures.cfg
|
phase1/texture1.lmp:
|
||||||
$(CPP) -DDOOM1 -DULTDOOM < textures.cfg | \
|
$(CPP) -DDOOM1 -DULTDOOM < textures.cfg | \
|
||||||
./build-textures -compat_texture1=doom1/texture1.txt \
|
./build-textures -compat_texture1=doom1/texture1.txt \
|
||||||
-compat_texture2=doom1/texture2.txt \
|
-compat_texture2=doom1/texture2.txt \
|
||||||
|
@ -16,14 +12,14 @@ $(PHASE1_OUTPUTS): textures.cfg
|
||||||
-output_texture2=phase1/texture2.lmp \
|
-output_texture2=phase1/texture2.lmp \
|
||||||
-output_pnames=phase1/pnames.lmp
|
-output_pnames=phase1/pnames.lmp
|
||||||
|
|
||||||
$(PHASE2_OUTPUTS): textures.cfg
|
phase2/texture1.lmp:
|
||||||
$(CPP) -DDOOM1 -DDOOM2 < textures.cfg | \
|
$(CPP) -DDOOM1 -DDOOM2 < textures.cfg | \
|
||||||
./build-textures -compat_texture1=doom2/texture1.txt \
|
./build-textures -compat_texture1=doom2/texture1.txt \
|
||||||
-compat_pnames=doom2/pnames.txt \
|
-compat_pnames=doom2/pnames.txt \
|
||||||
-output_texture1=phase2/texture1.lmp \
|
-output_texture1=phase2/texture1.lmp \
|
||||||
-output_pnames=phase2/pnames.lmp
|
-output_pnames=phase2/pnames.lmp
|
||||||
|
|
||||||
$(FREEDM_OUTPUTS): textures.cfg
|
freedm/texture1.lmp:
|
||||||
$(CPP) -DDOOM1 -DDOOM2 -DFREEDM < textures.cfg | \
|
$(CPP) -DDOOM1 -DDOOM2 -DFREEDM < textures.cfg | \
|
||||||
./build-textures -compat_texture1=doom2/texture1.txt \
|
./build-textures -compat_texture1=doom2/texture1.txt \
|
||||||
-compat_pnames=doom2/pnames.txt \
|
-compat_pnames=doom2/pnames.txt \
|
||||||
|
@ -32,5 +28,7 @@ $(FREEDM_OUTPUTS): textures.cfg
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(PHASE1_OUTPUTS) $(PHASE2_OUTPUTS) $(FREEDM_OUTPUTS)
|
rm -f phase1/texture1.lmp phase1/texture2.lmp phase1/pnames.lmp \
|
||||||
|
phase2/texture1.lmp phase2/pnames.lmp \
|
||||||
|
freedm/texture1.lmp freedm/pnames.lmp
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue