1 # 2 # QuakeWorld Makefile for Linux 2.0 3 # 4 # Apr '98 by Zoid <zoid (at] idsoftware.com> 5 # 6 # GNU Make required 7 # 8 9 ifneq (,$(findstring i86pc,$(shell uname -m))) 10 ARCH=i386 11 else 12 ARCH=sparc 13 endif 14 15 MAINDIR=/grog/Projects/QW 16 17 BUILD_DEBUG_DIR=debug$(ARCH) 18 BUILD_RELEASE_DIR=release$(ARCH) 19 CLIENT_DIR=$(MAINDIR)/client 20 SERVER_DIR=$(MAINDIR)/server 21 22 CC=gcc 23 BASE_CFLAGS=-Wall -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR) 24 RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math 25 # -funroll-loops -fomit-frame-pointer -fexpensive-optimizations 26 DEBUG_CFLAGS=$(BASE_CFLAGS) -g 27 28 LDFLAGS=-lm -lsocket -lnsl 29 30 DO_CC=$(CC) $(CFLAGS) -o $@ -c $< 31 DO_SERVER_CC=$(CC) -DSERVERONLY $(CFLAGS) -o $@ -c $< 32 33 ############################################################################# 34 # SETUP AND BUILD 35 ############################################################################# 36 37 TARGETS=$(BUILDDIR)/qwsv 38 39 build_debug: 40 @-mkdir $(BUILD_DEBUG_DIR) \ 41 $(BUILD_DEBUG_DIR)/server 42 $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)" 43 44 build_release: 45 @-mkdir $(BUILD_RELEASE_DIR) \ 46 $(BUILD_RELEASE_DIR)/server 47 $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(RELEASE_CFLAGS)" 48 49 all: build_debug build_release 50 51 targets: $(TARGETS) 52 53 ############################################################################# 54 # SERVER 55 ############################################################################# 56 57 QWSV_OBJS = \ 58 $(BUILDDIR)/server/pr_cmds.o \ 59 $(BUILDDIR)/server/pr_edict.o \ 60 $(BUILDDIR)/server/pr_exec.o \ 61 $(BUILDDIR)/server/sv_init.o \ 62 $(BUILDDIR)/server/sv_main.o \ 63 $(BUILDDIR)/server/sv_nchan.o \ 64 $(BUILDDIR)/server/sv_ents.o \ 65 $(BUILDDIR)/server/sv_send.o \ 66 $(BUILDDIR)/server/sv_move.o \ 67 $(BUILDDIR)/server/sv_phys.o \ 68 $(BUILDDIR)/server/sv_user.o \ 69 $(BUILDDIR)/server/sv_ccmds.o \ 70 $(BUILDDIR)/server/world.o \ 71 $(BUILDDIR)/server/sys_unix.o \ 72 $(BUILDDIR)/server/model.o \ 73 $(BUILDDIR)/server/cmd.o \ 74 $(BUILDDIR)/server/common.o \ 75 $(BUILDDIR)/server/crc.o \ 76 $(BUILDDIR)/server/cvar.o \ 77 $(BUILDDIR)/server/mathlib.o \ 78 $(BUILDDIR)/server/md4.o \ 79 $(BUILDDIR)/server/zone.o \ 80 $(BUILDDIR)/server/pmove.o \ 81 $(BUILDDIR)/server/pmovetst.o \ 82 $(BUILDDIR)/server/net_chan.o \ 83 $(BUILDDIR)/server/net_udp.o 84 85 $(BUILDDIR)/qwsv : $(QWSV_OBJS) 86 $(CC) $(CFLAGS) -o $@ $(QWSV_OBJS) $(LDFLAGS) 87 88 $(BUILDDIR)/server/pr_cmds.o : $(SERVER_DIR)/pr_cmds.c 89 $(DO_SERVER_CC) 90 91 $(BUILDDIR)/server/pr_edict.o : $(SERVER_DIR)/pr_edict.c 92 $(DO_SERVER_CC) 93 94 $(BUILDDIR)/server/pr_exec.o : $(SERVER_DIR)/pr_exec.c 95 $(DO_SERVER_CC) 96 97 $(BUILDDIR)/server/sv_init.o : $(SERVER_DIR)/sv_init.c 98 $(DO_SERVER_CC) 99 100 $(BUILDDIR)/server/sv_main.o : $(SERVER_DIR)/sv_main.c 101 $(DO_SERVER_CC) 102 103 $(BUILDDIR)/server/sv_nchan.o : $(SERVER_DIR)/sv_nchan.c 104 $(DO_SERVER_CC) 105 106 $(BUILDDIR)/server/sv_ents.o : $(SERVER_DIR)/sv_ents.c 107 $(DO_SERVER_CC) 108 109 $(BUILDDIR)/server/sv_send.o : $(SERVER_DIR)/sv_send.c 110 $(DO_SERVER_CC) 111 112 $(BUILDDIR)/server/sv_move.o : $(SERVER_DIR)/sv_move.c 113 $(DO_SERVER_CC) 114 115 $(BUILDDIR)/server/sv_phys.o : $(SERVER_DIR)/sv_phys.c 116 $(DO_SERVER_CC) 117 118 $(BUILDDIR)/server/sv_user.o : $(SERVER_DIR)/sv_user.c 119 $(DO_SERVER_CC) 120 121 $(BUILDDIR)/server/sv_ccmds.o : $(SERVER_DIR)/sv_ccmds.c 122 $(DO_SERVER_CC) 123 124 $(BUILDDIR)/server/world.o : $(SERVER_DIR)/world.c 125 $(DO_SERVER_CC) 126 127 $(BUILDDIR)/server/sys_unix.o : $(SERVER_DIR)/sys_unix.c 128 $(DO_SERVER_CC) 129 130 $(BUILDDIR)/server/model.o : $(SERVER_DIR)/model.c 131 $(DO_SERVER_CC) 132 133 $(BUILDDIR)/server/cmd.o : $(CLIENT_DIR)/cmd.c 134 $(DO_SERVER_CC) 135 136 $(BUILDDIR)/server/common.o : $(CLIENT_DIR)/common.c 137 $(DO_SERVER_CC) 138 139 $(BUILDDIR)/server/crc.o : $(CLIENT_DIR)/crc.c 140 $(DO_SERVER_CC) 141 142 $(BUILDDIR)/server/cvar.o : $(CLIENT_DIR)/cvar.c 143 $(DO_SERVER_CC) 144 145 $(BUILDDIR)/server/mathlib.o : $(CLIENT_DIR)/mathlib.c 146 $(DO_SERVER_CC) 147 148 $(BUILDDIR)/server/md4.o : $(CLIENT_DIR)/md4.c 149 $(DO_SERVER_CC) 150 151 $(BUILDDIR)/server/zone.o : $(CLIENT_DIR)/zone.c 152 $(DO_SERVER_CC) 153 154 $(BUILDDIR)/server/pmove.o : $(CLIENT_DIR)/pmove.c 155 $(DO_SERVER_CC) 156 157 $(BUILDDIR)/server/pmovetst.o : $(CLIENT_DIR)/pmovetst.c 158 $(DO_SERVER_CC) 159 160 $(BUILDDIR)/server/net_chan.o : $(CLIENT_DIR)/net_chan.c 161 $(DO_SERVER_CC) 162 163 $(BUILDDIR)/server/net_udp.o : $(CLIENT_DIR)/net_udp.c 164 $(DO_SERVER_CC) 165 166 ############################################################################# 167 # MISC 168 ############################################################################# 169 170 clean: clean-debug clean-release 171 172 clean-debug: 173 $(MAKE) clean2 BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)" 174 175 clean-release: 176 $(MAKE) clean2 BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(DEBUG_CFLAGS)" 177 178 clean2: 179 -rm -f $(QWSV_OBJS) \ 180 $(QWCL_OBJS) \ 181 $(QWCL_AS_OBJS) \ 182 $(QWCL_SVGA_OBJS) \ 183 $(QWCL_X11_OBJS) \ 184 $(GLQWCL_OBJS) \ 185 186