Makefile 4.13 KB
Newer Older
dylan grafmyre's avatar
dylan grafmyre committed
1
#
dylan grafmyre's avatar
dylan grafmyre committed
2
GAME?=hl2.exe
dylan grafmyre's avatar
dylan grafmyre committed
3
4
5
6
7

PYTHON_BIN?=./env/scripts/python
GARYSMOD_DIR?=D:\\Steam\\steamapps\\common\\GarrysMod\\
VBIN_DIR?=$(GARYSMOD_DIR)bin\\
MOD_DIR?=$(GARYSMOD_DIR)garrysmod\\
dylan grafmyre's avatar
dylan grafmyre committed
8
MOUNT_DIR?=.\\
dylan grafmyre's avatar
dylan grafmyre committed
9
10
VBIN_FLAGS?=-game $(MOD_DIR)

dylan grafmyre's avatar
dylan grafmyre committed
11
SUPERVISE_V_BIN?=./contrib/supervise-v
dylan grafmyre's avatar
dylan grafmyre committed
12
BSP_BIN?=$(SUPERVISE_V_BIN) $(VBIN_DIR)vbsp.exe
dylan grafmyre's avatar
dylan grafmyre committed
13
BSP_FLAGS?=$(VBIN_FLAGS)
dylan grafmyre's avatar
dylan grafmyre committed
14
VIS_BIN?=$(SUPERVISE_V_BIN) $(VBIN_DIR)vvis.exe
dylan grafmyre's avatar
dylan grafmyre committed
15
VIS_FLAGS?=$(VBIN_FLAGS) -fast
dylan grafmyre's avatar
dylan grafmyre committed
16
RAD_BIN?=$(SUPERVISE_V_BIN) $(VBIN_DIR)vrad.exe
dylan grafmyre's avatar
dylan grafmyre committed
17
18
RAD_FLAGS?=$(VBIN_FLAGS) -StaticPropLighting -bounce 2 -noextra
# -StaticPropSampleScale 0.25 
19
20
BSPZIP_BIN?=$(SUPERVISE_V_BIN) $(VBIN_DIR)bspzip.exe
BSPZIP_FLAGS?=$(VBIN_FLAGS)
Dylan Grafmyre's avatar
Dylan Grafmyre committed
21
22
23
24
GMAD_BIN?=$(VBIN_DIR)gmad.exe
GMAD_FLAGS?=
GMPUBLISH_BIN?=$(VBIN_DIR)gmpublish.exe
GMPUBLISH_FLAGS?=
dylan grafmyre's avatar
dylan grafmyre committed
25

dylan grafmyre's avatar
snap    
dylan grafmyre committed
26
GEN_BSPZIP_ADDLIST_BIN?=$(PYTHON_BIN) ./contrib/gen-bspzip-addlist
27
28
GEN_BSPZIP_ADDLIST_FLAGS?=--pack-used-local

dylan grafmyre's avatar
snap    
dylan grafmyre committed
29
30
31
J2_BIN?=$(PYTHON_BIN) ./contrib/j2
J2_FLAGS?=

dylan grafmyre's avatar
dylan grafmyre committed
32
# my take on compiling
dylan grafmyre's avatar
dylan grafmyre committed
33
34
35
	# vbsp: writes bsp
	# vvis: depends on .prt, r/w bsp
	# vrad: reads lights.rad, r/w bsp
dylan grafmyre's avatar
dylan grafmyre committed
36
37
38
39
%.bsp: %.vmf
	$(BSP_BIN) $(BSP_FLAGS) $(basename $^)
	$(VIS_BIN) $(VIS_FLAGS) $(basename $^)
	$(RAD_BIN) $(RAD_FLAGS) $(basename $^)
dylan grafmyre's avatar
dylan grafmyre committed
40
	cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
dylan grafmyre's avatar
dylan grafmyre committed
41
42
43
44
45

%.prt: %.bsp
	@test -f $@ || rm -f $(basename $@).bsp
	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(basename $@).bsp
%.log: %.bsp
46
	@test -f $@ ||rm -f $(basename $@).bsp
dylan grafmyre's avatar
dylan grafmyre committed
47
48
49
	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(basename $@).bsp

%_p.bsp: %.bsp
50
	$(BSPZIP_BIN) -addlist $^ $(^:.bsp=.bspzip-addlist) $@ $(BSPZIP_FLAGS) 
51
	cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
dylan grafmyre's avatar
dylan grafmyre committed
52

dylan grafmyre's avatar
dylan grafmyre committed
53
all: ttt_terrorcon_v2.bsp ttt_terrorcon_v2.lint ttt_terrorcon_v2.game
dylan grafmyre's avatar
snap    
dylan grafmyre committed
54

55
56
57
%.bspzip-addlist: %.vmf
	$(GEN_BSPZIP_ADDLIST_BIN) $(GEN_BSPZIP_ADDLIST_FLAGS) $^ > $@

dylan grafmyre's avatar
dylan grafmyre committed
58
%.game: %.bsp
dylan grafmyre's avatar
snap    
dylan grafmyre committed
59
60
61
62
63
ifeq ($(GAME),0)
	echo user disabled run game via GAME=0
else
	$(GARYSMOD_DIR)$(GAME) -allowdebug $(VBIN_FLAGS) +map $(notdir $(basename $^)) +gamemode terrortown +ttt_debug_preventwin 1 +ttt_preptime_seconds 10 +ttt_minimum_players 1
endif
dylan grafmyre's avatar
dylan grafmyre committed
64

dylan grafmyre's avatar
dylan grafmyre committed
65
install: ttt_terrorcon_v2_hdr_final_p.bsp
dylan grafmyre's avatar
dylan grafmyre committed
66
67
68
	cp -v $^ $(MOD_DIR)maps\\

%.lint: %.bspzip-addlist
69
	$(PYTHON_BIN) ./contrib/bspzip-lint $^ 2>&1 | tee $@
dylan grafmyre's avatar
dylan grafmyre committed
70
71
72
73
74
75
76
77
78
79


# hammer default flags
%_default.bsp: %.vmf
	# default
	$(BSP_BIN) $(VBIN_FLAGS) $(basename $^)
	$(VIS_BIN) $(VBIN_FLAGS) $(basename $^)
	$(RAD_BIN) $(VBIN_FLAGS) $(basename $^)
	mv $(@:_default.bsp=.bsp) $@
	cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
80
	$(GEN_BSPZIP_ADDLIST_BIN) $(GEN_BSPZIP_ADDLIST_FLAGS) $^ > $(@:.bsp=.bspzip-addlist)
dylan grafmyre's avatar
dylan grafmyre committed
81
82
83
84
85
86
87
88

%_fast.bsp: %.vmf
	# fast
	$(BSP_BIN) $(VBIN_FLAGS) $(basename $^)
	$(VIS_BIN) -fast $(VBIN_FLAGS) $(basename $^)
	$(RAD_BIN) -bounce 2 -noextra $(VBIN_FLAGS) $(basename $^) 
	mv  $(@:_fast.bsp=.bsp) $@
	cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
89
	$(GEN_BSPZIP_ADDLIST_BIN) $(GEN_BSPZIP_ADDLIST_FLAGS) $^ > $(@:.bsp=.bspzip-addlist)
dylan grafmyre's avatar
dylan grafmyre committed
90
91
92
93
94
95
96
97

%_hdr.bsp: %.vmf
	# hdr
	$(BSP_BIN) $(VBIN_FLAGS) $(basename $^)
	$(VIS_BIN) $(VBIN_FLAGS) $(basename $^)
	$(RAD_BIN) -both $(VBIN_FLAGS) $(basename $^)
	mv $(@:_hdr.bsp=.bsp) $@
	cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
98
	$(GEN_BSPZIP_ADDLIST_BIN) $(GEN_BSPZIP_ADDLIST_FLAGS) $^ > $(@:.bsp=.bspzip-addlist)
dylan grafmyre's avatar
dylan grafmyre committed
99
100
101
102
103
104
105
106

%_hdr_final.bsp: %.vmf
	# hdr-final
	$(BSP_BIN) $(VBIN_FLAGS) $(basename $^)
	$(VIS_BIN) $(VBIN_FLAGS) $(basename $^)
	$(RAD_BIN) -both -final $(VBIN_FLAGS) $(basename $^)
	mv $(@:_hdr_final.bsp=.bsp) $@
	cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
107
	$(GEN_BSPZIP_ADDLIST_BIN) $(GEN_BSPZIP_ADDLIST_FLAGS) $^ > $(@:.bsp=.bspzip-addlist)
dylan grafmyre's avatar
dylan grafmyre committed
108

dylan grafmyre's avatar
dylan grafmyre committed
109
110
111
112
113
114
115
# only ents works on an existing bsp,
# which are not typically left "in place" for this operation
#%_ents.bsp: %.vmf
#	# only-ents
#	$(BSP_BIN) -onlyents $(VBIN_FLAGS) $(basename $^)
#	mv $(@:_ents.bsp=.bsp) $@
#	cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
Dylan Grafmyre's avatar
Dylan Grafmyre committed
116

dylan grafmyre's avatar
snap    
dylan grafmyre committed
117
118
119
120
121
122
123
124
125
126
127
128
%.gma: %.bsp
	rm -rv \
		addons-src/maps/*.bsp \
		addons-src/materials/vgui/maps/*.vmt \
		addons-src/materials/vgui/maps/*.vtf \
		|| true
	cp $^ addons-src/maps/
	$(J2_BIN) $(J2_FLAGS) <addons-src/512x512.vmt.j2 $(basename $^).vmt >addons-src/materials/vgui/maps/menu_thumb_$(basename $^).vmt
	cp addons-src/512x512.vtf addons-src/materials/vgui/maps/menu_thumb_$(basename $^).vtf
	$(GMAD_BIN) $(GMAD_FLAGS) create -folder "addons-src" -out "addons/$@"

publish: addons/ttt_terrorcon_v2_hdr_final_p.gma
Dylan Grafmyre's avatar
Dylan Grafmyre committed
129
130
	$(GMPUBLISH_BIN) $(GMPUBLISH_FLAGS) create -addon "$^" -icon "addons/512x512.jpg"