Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

296 lines
6.4 KiB

  1. # Make command to use for dependencies
  2. SHELL=/bin/sh
  3. RM:=rm
  4. MKDIR:=mkdir
  5. OS:=$(shell uname)
  6. EXE_POSTFIX:=""
  7. # ---------------------------------------------------------------- #
  8. # Figure out if we're building in the Steam tree or not.
  9. # ---------------------------------------------------------------- #
  10. SRCROOT:=../..
  11. -include $(SRCROOT)/devtools/steam_def.mak
  12. # ---------------------------------------------------------------- #
  13. # Set paths to gcc.
  14. # ---------------------------------------------------------------- #
  15. CC:=gcc -m32
  16. CXX:=g++ -m32
  17. ifeq ($(OS),Darwin)
  18. CC:=clang -m32
  19. CXX:=clang++ -m32
  20. EXE_POSTFIX:=_osx
  21. endif
  22. ifeq ($(OS),Linux)
  23. CC=/valve/bin/gcc -m32
  24. CXX=/valve/bin/g++ -m32
  25. EXE_POSTFIX=_linux
  26. endif
  27. ifneq ($(CC_OVERRIDE),)
  28. CC:=$(CC_OVERRIDE)
  29. CXX:=$(CPP_OVERRIDE)
  30. endif
  31. # ---------------------------------------------------------------- #
  32. # Lists of files.
  33. # ---------------------------------------------------------------- #
  34. VPC_SRC:= \
  35. exprsimplifier.cpp \
  36. groupscript.cpp \
  37. conditionals.cpp \
  38. macros.cpp \
  39. projectscript.cpp \
  40. scriptsource.cpp \
  41. baseprojectdatacollector.cpp \
  42. configuration.cpp \
  43. dependencies.cpp \
  44. main.cpp \
  45. projectgenerator_makefile.cpp \
  46. projectgenerator_xcode.cpp \
  47. solutiongenerator_makefile.cpp \
  48. solutiongenerator_xcode.cpp \
  49. sys_utils.cpp \
  50. ../vpccrccheck/crccheck_shared.cpp
  51. TIER0_SRC:= \
  52. ../../tier0/assert_dialog.cpp \
  53. ../../tier0/cpu_posix.cpp \
  54. ../../tier0/cpu.cpp \
  55. ../../tier0/dbg.cpp \
  56. ../../tier0/fasttimer.cpp \
  57. ../../tier0/mem.cpp \
  58. ../../tier0/mem_helpers.cpp \
  59. ../../tier0/memdbg.cpp \
  60. ../../tier0/memstd.cpp \
  61. ../../tier0/memvalidate.cpp \
  62. ../../tier0/minidump.cpp \
  63. ../../tier0/pch_tier0.cpp \
  64. ../../tier0/threadtools.cpp \
  65. ../../tier0/valobject.cpp \
  66. ../../tier0/vprof.cpp
  67. TIER1_SRC:= \
  68. ../../tier1/keyvalues.cpp \
  69. ../../tier1/checksum_crc.cpp \
  70. ../../tier1/checksum_md5.cpp \
  71. ../../tier1/convar.cpp \
  72. ../../tier1/generichash.cpp \
  73. ../../tier1/interface.cpp \
  74. ../../tier1/mempool.cpp \
  75. ../../tier1/memstack.cpp \
  76. ../../tier1/stringpool.cpp \
  77. ../../tier1/utlbuffer.cpp \
  78. ../../tier1/utlsymbol.cpp
  79. VSTDLIB_SRC:= \
  80. ../../vstdlib/cvar.cpp \
  81. ../../vstdlib/vstrtools.cpp \
  82. ../../vstdlib/random.cpp
  83. ifeq "$(STEAM_BRANCH)" "1"
  84. TIER0_SRC+= \
  85. ../../tier0/tier0.cpp \
  86. ../../tier0/platform_posix.cpp \
  87. ../../tier0/validator.cpp \
  88. ../../tier0/thread.cpp \
  89. ../../tier0/pmelib.cpp \
  90. ../../tier0/pme_posix.cpp \
  91. ../../tier0/testthread.cpp \
  92. ../../tier0/cpu_posix.cpp \
  93. ../../tier0/memblockhdr.cpp
  94. VSTDLIB_SRC+= \
  95. ../../vstdlib/keyvaluessystem.cpp \
  96. ../../vstdlib/qsort_s.cpp \
  97. ../../vstdlib/strtools.cpp \
  98. ../../vstdlib/stringnormalize.cpp \
  99. ../../vstdlib/splitstring.cpp \
  100. ../../vstdlib/commandline.cpp
  101. INTERFACES_SRC=
  102. BINLAUNCH_SRC =
  103. else
  104. TIER0_SRC+= \
  105. ../../tier0/platform_posix.cpp \
  106. ../../tier0/pme_posix.cpp \
  107. ../../tier0/commandline.cpp \
  108. ../../tier0/win32consoleio.cpp \
  109. ../../tier0/logging.cpp \
  110. ../../tier0/tier0_strtools.cpp
  111. TIER1_SRC+= \
  112. ../../tier1/utlstring.cpp \
  113. ../../tier1/tier1.cpp \
  114. ../../tier1/characterset.cpp \
  115. ../../tier1/splitstring.cpp \
  116. ../../tier1/strtools.cpp \
  117. ../../tier1/exprevaluator.cpp \
  118. VSTDLIB_SRC+= \
  119. ../../vstdlib/keyvaluessystem.cpp
  120. INTERFACES_SRC= \
  121. ../../interfaces/interfaces.cpp
  122. BINLAUNCH_SRC = \
  123. endif
  124. SRC:=$(VPC_SRC) $(TIER0_SRC) $(TIER1_SRC) $(VSTDLIB_SRC) $(INTERFACES_SRC) $(BINLAUNCH_SRC)
  125. # -----Begin user-editable area-----
  126. # -----End user-editable area-----
  127. # If no configuration is specified, "Debug" will be used
  128. ifndef "CFG"
  129. CFG:=Release
  130. endif
  131. #
  132. # Configuration: Debug
  133. #
  134. ifeq "$(CFG)" "Debug"
  135. OUTDIR:=obj/$(OS)/debug
  136. CONFIG_DEPENDENT_FLAGS:=-O0
  137. ifeq ($(OS),Linux)
  138. CONFIG_DEPENDENT_FLAGS+=-g3 -ggdb -fpermissive
  139. endif
  140. else
  141. OUTDIR:=obj/$(OS)/release
  142. CONFIG_DEPENDENT_FLAGS:=-O3
  143. ifeq ($(OS),Linux)
  144. CONFIG_DEPENDENT_FLAGS+=-g3 -ggdb -fpermissive
  145. endif
  146. endif
  147. OBJS:=$(addprefix $(OUTDIR)/, $(subst ../../, ,$(SRC:.cpp=.o)))
  148. OUTFILE:=$(OUTDIR)/vpc
  149. CFG_INC:=-I../../public -I../../common -I../../public/tier0 \
  150. -I../../public/tier1 -I../../public/tier2 -I../../public/vstdlib
  151. CFLAGS=-D_POSIX -DPOSIX -DGNUC -DNDEBUG $(CONFIG_DEPENDENT_FLAGS) -msse -mmmx -pipe -w -fPIC $(CFG_INC)
  152. ifeq "$(STEAM_BRANCH)" "1"
  153. CFLAGS+= -DSTEAM
  154. endif
  155. ifeq "$(OS)" "Darwin"
  156. CFLAGS+=-I/usr/include/malloc
  157. CFLAGS+= -DOSX -D_OSX
  158. CFLAGS+= -arch i386 -fasm-blocks
  159. endif
  160. ifeq "$(OS)" "Linux"
  161. CFLAGS+= -DPLATFORM_LINUX -D_LINUX -DLINUX
  162. endif
  163. ifeq ($(CYGWIN),1)
  164. CFLAGS+=-D_CYGWIN -DCYGWIN -D_CYGWIN_WINDOWS_TARGET
  165. endif
  166. CFLAGS+= -DCOMPILER_GCC
  167. # the sed magic here adds the dependency file to the list of things that depend on the computed dependency
  168. # set, so if any of them change, the dependencies are re-made
  169. MAKEDEPEND=$(CXX) -M -MT $@ -MM $(CFLAGS) $< | sed -e 's@^\(.*\)\.o:@\1.d \1.o:@' > $(@:.o=.d)
  170. COMPILE=$(CXX) -c $(CFLAGS) -o $@ $<
  171. LINK=$(CXX) $(CONFIG_DEPENDENT_FLAGS) -ldl -lpthread -o "$(OUTFILE)" $(OBJS)
  172. ifeq "$(OS)" "Darwin"
  173. LINK+=-liconv -framework Foundation
  174. endif
  175. ifeq "$(OS)" "Darwin"
  176. LINK+= -arch i386
  177. endif
  178. # Build rules
  179. all: $(OUTFILE) ../../devtools/bin/vpc$(EXE_POSTFIX)
  180. ../../devtools/bin/vpc$(EXE_POSTFIX) : $(OUTFILE)
  181. cp "$(OUTFILE)" ../../devtools/bin/vpc$(EXE_POSTFIX)
  182. $(OUTFILE): Makefile $(OBJS)
  183. $(LINK)
  184. # Rebuild this project
  185. rebuild: cleanall all
  186. # Clean this project
  187. clean:
  188. $(RM) -f $(OUTFILE)
  189. $(RM) -f $(OBJS)
  190. $(RM) -f $(OBJS:.o=.d)
  191. $(RM) -f ../../devtools/bin/vpc$(EXE_POSTFIX)
  192. # Clean this project and all dependencies
  193. cleanall: clean
  194. # magic rules - tread with caution
  195. -include $(OBJS:.o=.d)
  196. # Pattern rules
  197. $(OUTDIR)/%.o : %.cpp
  198. -$(MKDIR) -p $(@D)
  199. @$(MAKEDEPEND);
  200. $(COMPILE)
  201. $(OUTDIR)/tier0/%.o : ../../tier0/%.cpp
  202. -$(MKDIR) -p $(@D)
  203. @$(MAKEDEPEND);
  204. $(COMPILE)
  205. $(OUTDIR)/tier1/%.o : ../../tier1/%.cpp
  206. -$(MKDIR) -p $(@D)
  207. @$(MAKEDEPEND);
  208. $(COMPILE)
  209. $(OUTDIR)/vstdlib/%.o : ../../vstdlib/%.cpp
  210. -$(MKDIR) -p $(@D)
  211. @$(MAKEDEPEND);
  212. $(COMPILE)
  213. $(OUTDIR)/interfaces/%.o : ../../interfaces/%.cpp
  214. if [ ! -d $(@D) ]; then $(MKDIR) $(@D); fi
  215. @$(MAKEDEPEND);
  216. $(COMPILE)
  217. $(OUTDIR)/utils/binlaunch/%.o : ../binlaunch/%.cpp
  218. if [ ! -d $(@D) ]; then $(MKDIR) $(@D); fi
  219. @$(MAKEDEPEND);
  220. $(COMPILE)
  221. # the tags file) seems like more work than it's worth. feel free to fix that up
  222. # if it bugs you.
  223. TAGS:
  224. @find . -name '*.cpp' -print0 | xargs -0 etags --declarations --ignore-indentation
  225. @find . -name '*.h' -print0 | xargs -0 etags --language=c++ --declarations --ignore-indentation --append
  226. @find . -name '*.c' -print0 | xargs -0 etags --declarations --ignore-indentation --append