1# 2# Quake Makefile for Solaris 3# 4# Nov '97 by Zoid <zoid@idsoftware.com> 5# 6# ELF only 7# 8 9VERSION=1.09 10 11ifneq (,$(findstring i86pc,$(shell uname -m))) 12ARCH=i386 13else 14ARCH=sparc 15endif 16 17MOUNT_DIR=/grog/Projects/WinQuake 18 19BUILD_DEBUG_DIR=debug$(ARCH) 20BUILD_RELEASE_DIR=release$(ARCH) 21 22CC=gcc 23BASE_CFLAGS=-I/usr/openwin/include 24 25RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations 26DEBUG_CFLAGS=$(BASE_CFLAGS) -g 27LDFLAGS=-R /usr/openwin/lib -L /usr/openwin/lib -lm -lX11 -lXext -lsocket -lnsl -lthread -ldl 28XIL_LDFLAGS=-L /opt/SUNWits/Graphics-sw/xil/lib -R /opt/SUNWits/Graphics-sw/xil/lib:/usr/openwin/lib -L /usr/openwin/lib -lm -lxil -lX11 -lXext -lsocket -lnsl -lthread -ldl 29 30DO_CC=$(CC) $(CFLAGS) -o $@ -c $< 31DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< 32 33############################################################################# 34# SETUP AND BUILD 35############################################################################# 36 37TARGETS=$(BUILDDIR)/quake.sw $(BUILDDIR)/quake.xil 38 39build_debug: 40 @-mkdir $(BUILD_DEBUG_DIR) 41 $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)" 42 43build_release: 44 @-mkdir $(BUILD_RELEASE_DIR) 45 $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(RELEASE_CFLAGS)" 46 47all: build_debug build_release 48 49targets: $(TARGETS) 50 51############################################################################# 52# CLIENT/SERVER 53############################################################################# 54 55QUAKE_OBJS= \ 56 $(BUILDDIR)/chase.o \ 57 $(BUILDDIR)/cl_demo.o \ 58 $(BUILDDIR)/cl_input.o \ 59 $(BUILDDIR)/cl_main.o \ 60 $(BUILDDIR)/cl_parse.o \ 61 $(BUILDDIR)/cl_tent.o \ 62 $(BUILDDIR)/cmd.o \ 63 $(BUILDDIR)/common.o \ 64 $(BUILDDIR)/console.o \ 65 $(BUILDDIR)/crc.o \ 66 $(BUILDDIR)/cvar.o \ 67 $(BUILDDIR)/draw.o \ 68 $(BUILDDIR)/d_edge.o \ 69 $(BUILDDIR)/d_fill.o \ 70 $(BUILDDIR)/d_init.o \ 71 $(BUILDDIR)/d_modech.o \ 72 $(BUILDDIR)/d_part.o \ 73 $(BUILDDIR)/d_polyse.o \ 74 $(BUILDDIR)/d_scan.o \ 75 $(BUILDDIR)/d_sky.o \ 76 $(BUILDDIR)/d_sprite.o \ 77 $(BUILDDIR)/d_surf.o \ 78 $(BUILDDIR)/d_vars.o \ 79 $(BUILDDIR)/d_zpoint.o \ 80 $(BUILDDIR)/host.o \ 81 $(BUILDDIR)/host_cmd.o \ 82 $(BUILDDIR)/keys.o \ 83 $(BUILDDIR)/menu.o \ 84 $(BUILDDIR)/mathlib.o \ 85 $(BUILDDIR)/model.o \ 86 $(BUILDDIR)/nonintel.o \ 87 $(BUILDDIR)/pr_cmds.o \ 88 $(BUILDDIR)/pr_edict.o \ 89 $(BUILDDIR)/pr_exec.o \ 90 $(BUILDDIR)/r_aclip.o \ 91 $(BUILDDIR)/r_alias.o \ 92 $(BUILDDIR)/r_bsp.o \ 93 $(BUILDDIR)/r_light.o \ 94 $(BUILDDIR)/r_draw.o \ 95 $(BUILDDIR)/r_efrag.o \ 96 $(BUILDDIR)/r_edge.o \ 97 $(BUILDDIR)/r_misc.o \ 98 $(BUILDDIR)/r_main.o \ 99 $(BUILDDIR)/r_sky.o \ 100 $(BUILDDIR)/r_sprite.o \ 101 $(BUILDDIR)/r_surf.o \ 102 $(BUILDDIR)/r_part.o \ 103 $(BUILDDIR)/r_vars.o \ 104 $(BUILDDIR)/screen.o \ 105 $(BUILDDIR)/sbar.o \ 106 $(BUILDDIR)/sv_main.o \ 107 $(BUILDDIR)/sv_phys.o \ 108 $(BUILDDIR)/sv_move.o \ 109 $(BUILDDIR)/sv_user.o \ 110 $(BUILDDIR)/zone.o \ 111 $(BUILDDIR)/view.o \ 112 $(BUILDDIR)/wad.o \ 113 $(BUILDDIR)/world.o \ 114 $(BUILDDIR)/cd_null.o \ 115 $(BUILDDIR)/snd_dma.o \ 116 $(BUILDDIR)/snd_mix.o \ 117 $(BUILDDIR)/snd_mem.o \ 118 $(BUILDDIR)/net_dgrm.o \ 119 $(BUILDDIR)/net_loop.o \ 120 $(BUILDDIR)/net_main.o \ 121 $(BUILDDIR)/net_vcr.o \ 122 $(BUILDDIR)/net_udp.o \ 123 $(BUILDDIR)/net_bsd.o \ 124 $(BUILDDIR)/sys_sun.o \ 125 $(BUILDDIR)/snd_sun.o 126 127QUAKE_AS_OBJS= \ 128 $(BUILDDIR)/d_copy.o \ 129 $(BUILDDIR)/d_draw.o \ 130 $(BUILDDIR)/d_draw16.o \ 131 $(BUILDDIR)/d_parta.o \ 132 $(BUILDDIR)/d_polysa.o \ 133 $(BUILDDIR)/d_scana.o \ 134 $(BUILDDIR)/d_spr8.o \ 135 $(BUILDDIR)/d_varsa.o \ 136 $(BUILDDIR)/math.o \ 137 $(BUILDDIR)/r_aliasa.o \ 138 $(BUILDDIR)/r_drawa.o \ 139 $(BUILDDIR)/r_edgea.o \ 140 $(BUILDDIR)/r_varsa.o \ 141 $(BUILDDIR)/surf16.o \ 142 $(BUILDDIR)/surf8.o \ 143 $(BUILDDIR)/worlda.o \ 144 $(BUILDDIR)/r_aclipa.o \ 145 $(BUILDDIR)/snd_mixa.o \ 146 $(BUILDDIR)/sys_dosa.o 147 148QUAKE_X_OBJS = $(BUILDDIR)/vid_sunx.o 149 150QUAKE_XIL_OBJS = $(BUILDDIR)/vid_sunxil.o 151 152ifeq ($(ARCH),i386) 153$(BUILDDIR)/quake.sw : $(QUAKE_OBJS) $(QUAKE_AS_OBJS) $(QUAKE_X_OBJS) 154 $(CC) -o $(@) $(QUAKE_OBJS) $(QUAKE_AS_OBJS) $(QUAKE_X_OBJS) $(LDFLAGS) 155 156$(BUILDDIR)/quake.xil: $(QUAKE_OBJS) $(QUAKE_AS_OBJS) $(QUAKE_XIL_OBJS) 157 $(CC) -o $(@) $(QUAKE_OBJS) $(QUAKE_AS_OBJS) $(QUAKE_XIL_OBJS) $(XIL_LDFLAGS) 158else 159$(BUILDDIR)/quake.sw : $(QUAKE_OBJS) $(QUAKE_X_OBJS) 160 $(CC) -o $(@) $(QUAKE_OBJS) $(QUAKE_X_OBJS) $(LDFLAGS) 161 162$(BUILDDIR)/quake.xil: $(QUAKE_OBJS) $(QUAKE_XIL_OBJS) 163 $(CC) -o $(@) $(QUAKE_OBJS) $(QUAKE_XIL_OBJS) $(XIL_LDFLAGS) 164endif 165 166## 167 168$(BUILDDIR)/chase.o : $(MOUNT_DIR)/chase.c 169 $(DO_CC) 170 171$(BUILDDIR)/cl_demo.o : $(MOUNT_DIR)/cl_demo.c 172 $(DO_CC) 173 174$(BUILDDIR)/cl_input.o : $(MOUNT_DIR)/cl_input.c 175 $(DO_CC) 176 177$(BUILDDIR)/cl_main.o : $(MOUNT_DIR)/cl_main.c 178 $(DO_CC) 179 180$(BUILDDIR)/cl_parse.o : $(MOUNT_DIR)/cl_parse.c 181 $(DO_CC) 182 183$(BUILDDIR)/cl_tent.o : $(MOUNT_DIR)/cl_tent.c 184 $(DO_CC) 185 186$(BUILDDIR)/cmd.o : $(MOUNT_DIR)/cmd.c 187 $(DO_CC) 188 189$(BUILDDIR)/common.o : $(MOUNT_DIR)/common.c 190 $(DO_CC) 191 192$(BUILDDIR)/console.o : $(MOUNT_DIR)/console.c 193 $(DO_CC) 194 195$(BUILDDIR)/crc.o : $(MOUNT_DIR)/crc.c 196 $(DO_CC) 197 198$(BUILDDIR)/cvar.o : $(MOUNT_DIR)/cvar.c 199 $(DO_CC) 200 201$(BUILDDIR)/draw.o : $(MOUNT_DIR)/draw.c 202 $(DO_CC) 203 204$(BUILDDIR)/d_edge.o : $(MOUNT_DIR)/d_edge.c 205 $(DO_CC) 206 207$(BUILDDIR)/d_fill.o : $(MOUNT_DIR)/d_fill.c 208 $(DO_CC) 209 210$(BUILDDIR)/d_init.o : $(MOUNT_DIR)/d_init.c 211 $(DO_CC) 212 213$(BUILDDIR)/d_modech.o : $(MOUNT_DIR)/d_modech.c 214 $(DO_CC) 215 216$(BUILDDIR)/d_part.o : $(MOUNT_DIR)/d_part.c 217 $(DO_CC) 218 219$(BUILDDIR)/d_polyse.o : $(MOUNT_DIR)/d_polyse.c 220 $(DO_CC) 221 222$(BUILDDIR)/d_scan.o : $(MOUNT_DIR)/d_scan.c 223 $(DO_CC) 224 225$(BUILDDIR)/d_sky.o : $(MOUNT_DIR)/d_sky.c 226 $(DO_CC) 227 228$(BUILDDIR)/d_sprite.o : $(MOUNT_DIR)/d_sprite.c 229 $(DO_CC) 230 231$(BUILDDIR)/d_surf.o : $(MOUNT_DIR)/d_surf.c 232 $(DO_CC) 233 234$(BUILDDIR)/d_vars.o : $(MOUNT_DIR)/d_vars.c 235 $(DO_CC) 236 237$(BUILDDIR)/d_zpoint.o : $(MOUNT_DIR)/d_zpoint.c 238 $(DO_CC) 239 240$(BUILDDIR)/host.o : $(MOUNT_DIR)/host.c 241 $(DO_CC) 242 243$(BUILDDIR)/host_cmd.o : $(MOUNT_DIR)/host_cmd.c 244 $(DO_CC) 245 246$(BUILDDIR)/keys.o : $(MOUNT_DIR)/keys.c 247 $(DO_CC) 248 249$(BUILDDIR)/menu.o : $(MOUNT_DIR)/menu.c 250 $(DO_CC) 251 252$(BUILDDIR)/mathlib.o : $(MOUNT_DIR)/mathlib.c 253 $(DO_CC) 254 255$(BUILDDIR)/model.o : $(MOUNT_DIR)/model.c 256 $(DO_CC) 257 258$(BUILDDIR)/nonintel.o : $(MOUNT_DIR)/nonintel.c 259 $(DO_CC) 260 261$(BUILDDIR)/pr_cmds.o : $(MOUNT_DIR)/pr_cmds.c 262 $(DO_CC) 263 264$(BUILDDIR)/pr_edict.o : $(MOUNT_DIR)/pr_edict.c 265 $(DO_CC) 266 267$(BUILDDIR)/pr_exec.o : $(MOUNT_DIR)/pr_exec.c 268 $(DO_CC) 269 270$(BUILDDIR)/r_aclip.o : $(MOUNT_DIR)/r_aclip.c 271 $(DO_CC) 272 273$(BUILDDIR)/r_alias.o : $(MOUNT_DIR)/r_alias.c 274 $(DO_CC) 275 276$(BUILDDIR)/r_bsp.o : $(MOUNT_DIR)/r_bsp.c 277 $(DO_CC) 278 279$(BUILDDIR)/r_light.o : $(MOUNT_DIR)/r_light.c 280 $(DO_CC) 281 282$(BUILDDIR)/r_draw.o : $(MOUNT_DIR)/r_draw.c 283 $(DO_CC) 284 285$(BUILDDIR)/r_efrag.o : $(MOUNT_DIR)/r_efrag.c 286 $(DO_CC) 287 288$(BUILDDIR)/r_edge.o : $(MOUNT_DIR)/r_edge.c 289 $(DO_CC) 290 291$(BUILDDIR)/r_misc.o : $(MOUNT_DIR)/r_misc.c 292 $(DO_CC) 293 294$(BUILDDIR)/r_main.o : $(MOUNT_DIR)/r_main.c 295 $(DO_CC) 296 297$(BUILDDIR)/r_sky.o : $(MOUNT_DIR)/r_sky.c 298 $(DO_CC) 299 300$(BUILDDIR)/r_sprite.o : $(MOUNT_DIR)/r_sprite.c 301 $(DO_CC) 302 303$(BUILDDIR)/r_surf.o : $(MOUNT_DIR)/r_surf.c 304 $(DO_CC) 305 306$(BUILDDIR)/r_part.o : $(MOUNT_DIR)/r_part.c 307 $(DO_CC) 308 309$(BUILDDIR)/r_vars.o : $(MOUNT_DIR)/r_vars.c 310 $(DO_CC) 311 312$(BUILDDIR)/screen.o : $(MOUNT_DIR)/screen.c 313 $(DO_CC) 314 315$(BUILDDIR)/sbar.o : $(MOUNT_DIR)/sbar.c 316 $(DO_CC) 317 318$(BUILDDIR)/sv_main.o : $(MOUNT_DIR)/sv_main.c 319 $(DO_CC) 320 321$(BUILDDIR)/sv_phys.o : $(MOUNT_DIR)/sv_phys.c 322 $(DO_CC) 323 324$(BUILDDIR)/sv_move.o : $(MOUNT_DIR)/sv_move.c 325 $(DO_CC) 326 327$(BUILDDIR)/sv_user.o : $(MOUNT_DIR)/sv_user.c 328 $(DO_CC) 329 330$(BUILDDIR)/zone.o : $(MOUNT_DIR)/zone.c 331 $(DO_CC) 332 333$(BUILDDIR)/view.o : $(MOUNT_DIR)/view.c 334 $(DO_CC) 335 336$(BUILDDIR)/wad.o : $(MOUNT_DIR)/wad.c 337 $(DO_CC) 338 339$(BUILDDIR)/world.o : $(MOUNT_DIR)/world.c 340 $(DO_CC) 341 342$(BUILDDIR)/cd_null.o : $(MOUNT_DIR)/cd_null.c 343 $(DO_CC) 344 345$(BUILDDIR)/snd_dma.o : $(MOUNT_DIR)/snd_dma.c 346 $(DO_CC) 347 348$(BUILDDIR)/snd_mix.o : $(MOUNT_DIR)/snd_mix.c 349 $(DO_CC) 350 351$(BUILDDIR)/snd_mem.o : $(MOUNT_DIR)/snd_mem.c 352 $(DO_CC) 353 354$(BUILDDIR)/net_dgrm.o : $(MOUNT_DIR)/net_dgrm.c 355 $(DO_CC) 356 357$(BUILDDIR)/net_loop.o : $(MOUNT_DIR)/net_loop.c 358 $(DO_CC) 359 360$(BUILDDIR)/net_main.o : $(MOUNT_DIR)/net_main.c 361 $(DO_CC) 362 363$(BUILDDIR)/net_vcr.o : $(MOUNT_DIR)/net_vcr.c 364 $(DO_CC) 365 366$(BUILDDIR)/net_udp.o : $(MOUNT_DIR)/net_udp.c 367 $(DO_CC) 368 369$(BUILDDIR)/net_bsd.o : $(MOUNT_DIR)/net_bsd.c 370 $(DO_CC) 371 372$(BUILDDIR)/sys_sun.o : $(MOUNT_DIR)/sys_sun.c 373 $(DO_CC) 374 375$(BUILDDIR)/snd_sun.o : $(MOUNT_DIR)/snd_sun.c 376 $(DO_CC) 377 378$(BUILDDIR)/in_sun.o : $(MOUNT_DIR)/in_sun.c 379 $(DO_CC) 380 381$(BUILDDIR)/vid_sunx.o : $(MOUNT_DIR)/vid_sunx.c 382 $(DO_CC) 383 384$(BUILDDIR)/vid_sunxil.o : $(MOUNT_DIR)/vid_sunxil.c 385 $(DO_CC) 386 387##### 388 389$(BUILDDIR)/d_copy.o : $(MOUNT_DIR)/d_copy.s 390 $(DO_AS) 391 392$(BUILDDIR)/d_draw.o : $(MOUNT_DIR)/d_draw.s 393 $(DO_AS) 394 395$(BUILDDIR)/d_draw16.o : $(MOUNT_DIR)/d_draw16.s 396 $(DO_AS) 397 398$(BUILDDIR)/d_parta.o : $(MOUNT_DIR)/d_parta.s 399 $(DO_AS) 400 401$(BUILDDIR)/d_polysa.o : $(MOUNT_DIR)/d_polysa.s 402 $(DO_AS) 403 404$(BUILDDIR)/d_scana.o : $(MOUNT_DIR)/d_scana.s 405 $(DO_AS) 406 407$(BUILDDIR)/d_spr8.o : $(MOUNT_DIR)/d_spr8.s 408 $(DO_AS) 409 410$(BUILDDIR)/d_varsa.o : $(MOUNT_DIR)/d_varsa.s 411 $(DO_AS) 412 413$(BUILDDIR)/math.o : $(MOUNT_DIR)/math.s 414 $(DO_AS) 415 416$(BUILDDIR)/r_aliasa.o : $(MOUNT_DIR)/r_aliasa.s 417 $(DO_AS) 418 419$(BUILDDIR)/r_drawa.o : $(MOUNT_DIR)/r_drawa.s 420 $(DO_AS) 421 422$(BUILDDIR)/r_edgea.o : $(MOUNT_DIR)/r_edgea.s 423 $(DO_AS) 424 425$(BUILDDIR)/r_varsa.o : $(MOUNT_DIR)/r_varsa.s 426 $(DO_AS) 427 428$(BUILDDIR)/surf16.o : $(MOUNT_DIR)/surf16.s 429 $(DO_AS) 430 431$(BUILDDIR)/surf8.o : $(MOUNT_DIR)/surf8.s 432 $(DO_AS) 433 434$(BUILDDIR)/worlda.o : $(MOUNT_DIR)/worlda.s 435 $(DO_AS) 436 437$(BUILDDIR)/r_aclipa.o : $(MOUNT_DIR)/r_aclipa.s 438 $(DO_AS) 439 440$(BUILDDIR)/snd_mixa.o : $(MOUNT_DIR)/snd_mixa.s 441 $(DO_AS) 442 443$(BUILDDIR)/sys_dosa.o : $(MOUNT_DIR)/sys_dosa.s 444 $(DO_AS) 445 446############################################################################# 447# TAR 448############################################################################# 449 450# Make RPMs. You need to be root to make this work 451RPMDIR = /var/tmp/quake-$(VERSION) 452 453tar: 454 if [ ! -d archives ];then mkdir archives;fi 455 $(MAKE) copyfiles COPYDIR=$(RPMDIR) 456 cd $(RPMDIR); tar cvf q2ded-$(VERSION)-$(ARCH)-sun-solaris2.5.1.tar * 457 cd $(RPMDIR); compress q2ded-$(VERSION)-$(ARCH)-sun-solaris2.5.1.tar 458 mv $(RPMDIR)/*.tar.Z archives/. 459 rm -rf $(RPMDIR) 460 461copyfiles: 462 -mkdirhier $(COPYDIR) 463 cp $(BUILD_RELEASE_DIR)/quake.sw $(COPYDIR) 464 cp $(BUILD_RELEASE_DIR)/quake.xil $(COPYDIR) 465 strip $(COPYDIR)/quake 466 strip $(COPYDIR)/quake.xil 467 cp $(MOUNT_DIR)/README.Solaris $(COPYDIR)/README.Solaris 468 469############################################################################# 470# MISC 471############################################################################# 472 473clean: clean-debug clean-release 474 475clean-debug: 476 $(MAKE) clean2 BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)" 477 478clean-release: 479 $(MAKE) clean2 BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(DEBUG_CFLAGS)" 480 481clean2: 482 -rm -f $(QUAKE_OBJS) $(QUAKE_X_OBJS) $(QUAKE_XIL_OBJS) 483 484