summaryrefslogtreecommitdiff
path: root/Makefile
blob: 644abefa9d22ade806a1603c6641dfd027ee108a (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
#
# Settings
# Use Makefile.local for local settings
#

FS_BASEPATH ?= $(HOME)/tremulous
FS_HOMEBASE ?= .tremulous
TREMULOUS ?= tremulous

Q3MAP_THREADS ?= 8
Q3MAP         ?= q3map2
Q3MAP_FLAGS   += -fs_basepath $(FS_BASEPATH) -fs_homebase $(FS_HOMEBASE) \
                 -fs_game base -threads $(Q3MAP_THREADS)

FAST ?= 0

ifeq ($(FAST), 0)
	Q3MAP_BSP    += -leaktest -meta -custinfoparms
	Q3MAP_VIS    += -vis
	Q3MAP_LIGHT  += -light -bounce 1 -dirty -bouncegrid -dirtscale 0.3 \
	                -dirtdepth 32 -fastbounce -patchshadows -samples 3 \
	                -samplesize 8 -cpma
endif

ifeq ($(FAST), 1)
	Q3MAP_BSP    += -leaktest -meta -custinfoparms
	Q3MAP_VIS    += -vis
	Q3MAP_LIGHT  += -light -fast -patchshadows
endif

ifeq ($(FAST), 2)
	Q3MAP_BSP    += -leaktest -meta -custinfoparms
	Q3MAP_VIS    += -vis
	# Skip lighting entirely.
endif

MAPCAT       ?= mapcat
MAPCAT_FLAGS +=

PARTS := maps/p0_master.map \
         maps/p1_bases.map \
         maps/p2_clockroom.map \
         maps/p3_dretchpwner.map \
         maps/p4_thepress.map \
         maps/p5_euclid.map \
         maps/p6_engineering.map \
         maps/p7_uncommon.map \
         maps/p8_outside.map \
         maps/p9_reactor.map \
         maps/p10_nexus.map \
         maps/p11_archive.map \
         maps/p12_xen.map \
         maps/p13_vents.map \
         maps/p14_106.map
WHOLE := maps/analmango

MAP ?= analmango
.DEFAULT_GOAL := maps/$(MAP).bsp

-include Makefile.local

#
# Creating a .pk3 with all the assets
#

PK3 ?= analmango.pk3
$(PK3): $(WHOLE).bsp
	cat pk3.list | (while read ent; do echo $$ent; done) | xargs zip -r9 $(PK3)

#
# Testing a map
#
test: maps/$(MAP).bsp
	$(TREMULOUS) +devmap $(MAP)

#
# Assembling the complete .map from parts
#

$(WHOLE).map: $(PARTS)
	$(MAPCAT) $(MAPCAT_FLAGS) $^ -o $@

#
# Compiling .map files into .bsp files
#

maps/%.bsp: maps/%.map
	$(Q3MAP) $(Q3MAP_FLAGS) $(Q3MAP_BSP) $<
ifdef Q3MAP_VIS
	$(Q3MAP) $(Q3MAP_FLAGS) $(Q3MAP_VIS) $<
endif
ifdef Q3MAP_LIGHT
	$(Q3MAP) $(Q3MAP_FLAGS) $(Q3MAP_LIGHT) $<
endif

#
# Miscellaneous Make stuff
#

clean:
	rm -f *.pk3
	rm -f maps/*.bsp
	rm -f $(WHOLE).*

.PHONY: clean test