Clone of mesa.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Makefile.mgw 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. # Mesa 3-D graphics library
  2. # Version: 7.0
  3. #
  4. # Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
  5. #
  6. # Permission is hereby granted, free of charge, to any person obtaining a
  7. # copy of this software and associated documentation files (the "Software"),
  8. # to deal in the Software without restriction, including without limitation
  9. # the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. # and/or sell copies of the Software, and to permit persons to whom the
  11. # Software is furnished to do so, subject to the following conditions:
  12. #
  13. # The above copyright notice and this permission notice shall be included
  14. # in all copies or substantial portions of the Software.
  15. #
  16. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17. # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. # BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  20. # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. # MinGW core makefile v1.4 for Mesa
  23. #
  24. # Copyright (C) 2002 - Daniel Borca
  25. # Email : dborca@users.sourceforge.net
  26. # Web : http://www.geocities.com/dborca
  27. # MinGW core-gl makefile updated for Mesa 7.0
  28. #
  29. # updated : by Heromyth, on 2007-7-21
  30. # Email : zxpmyth@yahoo.com.cn
  31. # Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
  32. # The others havn't been tested yet.
  33. # 2) The generated DLLs are *not* compatible with the ones built
  34. # with the other compilers like VC8, especially for GLUT.
  35. # 3) Although more tests are needed, it can be used individually!
  36. #
  37. # Available options:
  38. #
  39. # Environment variables:
  40. # CFLAGS
  41. #
  42. # GLIDE path to Glide3 SDK; used with FX.
  43. # default = $(TOP)/glide3
  44. # FX=1 build for 3dfx Glide3. Note that this disables
  45. # compilation of most WMesa code and requires fxMesa.
  46. # As a consequence, you'll need the Win32 Glide3
  47. # library to build any application.
  48. # default = no
  49. # ICD=1 build the installable client driver interface
  50. # (windows opengl driver interface)
  51. # default = no
  52. # X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
  53. # default = no
  54. #
  55. # Targets:
  56. # all: build GL
  57. # clean: remove object files
  58. #
  59. .PHONY: all clean
  60. .INTERMEDIATE: x86/gen_matypes.exe
  61. .SUFFIXES: .rc .res
  62. # Set this to the prefix of your build tools, i.e. mingw32-
  63. TOOLS_PREFIX = mingw32-
  64. TOP = ../..
  65. GLIDE ?= $(TOP)/glide3
  66. LIBDIR = $(TOP)/lib
  67. ifeq ($(ICD),1)
  68. GL_DLL = mesa32.dll
  69. GL_IMP = libmesa32.a
  70. else
  71. GL_DLL = opengl32.dll
  72. GL_IMP = libopengl32.a
  73. endif
  74. GL_DEF = gl.def
  75. include $(TOP)/configs/config.mgw
  76. GL_USING_STDCALL ?= 1
  77. MESA_LIB = libmesa.a
  78. LDLIBS = -lgdi32 -luser32 -liberty
  79. LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GL_IMP) -Wl,--output-def=$(LIBDIR)/gl.def
  80. CC = $(TOOLS_PREFIX)gcc
  81. CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_DLL -DMESA_MINWARN -DNDEBUG -D_USRDLL -DGDI_EXPORTS
  82. ifeq ($(GL_USING_STDCALL),1)
  83. LDFLAGS += -Wl,--add-stdcall-alias
  84. else
  85. CFLAGS += -DGL_NO_STDCALL
  86. endif
  87. CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1
  88. ifeq ($(FX),1)
  89. CFLAGS += -I$(GLIDE)/include -DFX
  90. LDLIBS += -L$(GLIDE)/lib -lglide3x
  91. GL_DEF = drivers/windows/fx/fxopengl.def
  92. GL_RES = drivers/windows/fx/fx.rc
  93. else
  94. ifeq ($(ICD),1)
  95. CFLAGS += -DUSE_MGL_NAMESPACE
  96. GL_DEF = drivers/windows/icd/mesa.def
  97. else
  98. GL_DEF = drivers/windows/gdi/mesa.def
  99. endif
  100. endif
  101. AR = ar
  102. ARFLAGS = crus
  103. UNLINK = del $(subst /,\,$(1))
  104. ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
  105. UNLINK = $(RM) $(1)
  106. endif
  107. ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
  108. UNLINK = $(RM) $(1)
  109. endif
  110. include sources
  111. CFLAGS += $(INCLUDE_DIRS)
  112. ifeq ($(X86),1)
  113. CFLAGS += -DUSE_X86_ASM
  114. CFLAGS += -DUSE_MMX_ASM
  115. CFLAGS += -DUSE_SSE_ASM
  116. CFLAGS += -DUSE_3DNOW_ASM
  117. X86_SOURCES += $(X86_API)
  118. else
  119. X86_SOURCES =
  120. endif
  121. ifeq ($(FX),1)
  122. DRIVER_SOURCES = \
  123. $(GLIDE_DRIVER_SOURCES) \
  124. drivers/windows/fx/fxwgl.c
  125. else
  126. ifeq ($(ICD),1)
  127. DRIVER_SOURCES = \
  128. drivers/windows/gdi/wmesa.c \
  129. drivers/windows/icd/icd.c
  130. else
  131. DRIVER_SOURCES = \
  132. drivers/windows/gdi/wmesa.c \
  133. drivers/windows/gdi/wgl.c
  134. endif
  135. endif
  136. SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES)
  137. OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
  138. X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
  139. RESOURCE = $(GL_RES:.rc=.res)
  140. .c.o:
  141. $(CC) -o $@ $(CFLAGS) -c $<
  142. .s.o:
  143. $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
  144. .rc.res:
  145. windres -o $@ -Irc -Ocoff $<
  146. all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
  147. $(LIBDIR):
  148. mkdir -p $(LIBDIR)
  149. $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
  150. $(CC) -shared -fPIC -o $(LIBDIR)/$(GL_DLL) $(LDFLAGS) \
  151. $^ $(LDLIBS)
  152. $(X86_OBJECTS): x86/matypes.h
  153. x86/matypes.h: x86/gen_matypes.exe
  154. $(subst /,\,$< > $@)
  155. x86/gen_matypes.exe: x86/gen_matypes.c
  156. $(CC) -o $@ $(CFLAGS) -s $<
  157. # [dBorca]
  158. # glapi_x86.S needs some adjustments
  159. # in order to generate correct entrypoints
  160. # Trick: change the following condition to
  161. # be always false if you need C entrypoints
  162. # with USE_X86_ASM (useful for trace/debug)
  163. ifeq (1,1)
  164. x86/glapi_x86.o: x86/glapi_x86.S
  165. $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
  166. else
  167. main/dispatch.o: main/dispatch.c
  168. $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
  169. glapi/glapi.o: glapi/glapi.c
  170. $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
  171. endif
  172. # [dBorca]
  173. # if we want codegen, we have to stdcall
  174. tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S
  175. $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
  176. clean:
  177. -$(call UNLINK,glapi/*.o)
  178. -$(call UNLINK,main/*.o)
  179. -$(call UNLINK,math/*.o)
  180. -$(call UNLINK,vbo/*.o)
  181. -$(call UNLINK,shader/*.o)
  182. -$(call UNLINK,shader/slang/*.o)
  183. -$(call UNLINK,shader/grammar/*.o)
  184. -$(call UNLINK,sparc/*.o)
  185. -$(call UNLINK,ppc/*.o)
  186. -$(call UNLINK,swrast/*.o)
  187. -$(call UNLINK,swrast_setup/*.o)
  188. -$(call UNLINK,tnl/*.o)
  189. -$(call UNLINK,x86/*.o)
  190. -$(call UNLINK,x86/rtasm/*.o)
  191. -$(call UNLINK,x86-64/*.o)
  192. -$(call UNLINK,drivers/common/*.o)
  193. -$(call UNLINK,drivers/glide/*.o)
  194. -$(call UNLINK,drivers/windows/fx/*.o)
  195. -$(call UNLINK,drivers/windows/fx/*.res)
  196. -$(call UNLINK,drivers/windows/gdi/*.o)
  197. -$(call UNLINK,drivers/windows/icd/*.o)