Clone of mesa.
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.

Makefile.mgw 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. ifeq ($(ICD),1)
  65. LIB_NAME = mesa32
  66. else
  67. LIB_NAME = opengl32
  68. endif
  69. DLL_EXT = .dll
  70. IMP_EXT = .a
  71. LIB_PRE = lib
  72. STRIP = -s
  73. AR = ar
  74. ARFLAGS = crus
  75. DLLTOOL = dlltool
  76. TOP = ../..
  77. GLIDE ?= $(TOP)/glide3
  78. LIBDIR = $(TOP)/lib
  79. GL_DLL = $(LIB_NAME)$(DLL_EXT)
  80. GL_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
  81. MESA_LIB = libmesa.a
  82. CC = $(TOOLS_PREFIX)gcc
  83. LDLIBS = -lgdi32 -luser32 -liberty
  84. LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
  85. CFLAGS += -DBUILD_GL32 -D_DLL -DMESA_MINWARN
  86. CFLAGS += -DNDEBUG -DUSE_EXTERNAL_DXTN_LIB=1
  87. ifeq ($(FX),1)
  88. CFLAGS += -I$(GLIDE)/include -DFX
  89. LDLIBS += -L$(GLIDE)/lib -lglide3x
  90. GL_DEF = drivers/windows/fx/fxopengl.def
  91. GL_RES = drivers/windows/fx/fx.rc
  92. else
  93. ifeq ($(ICD),1)
  94. CFLAGS += -DUSE_MGL_NAMESPACE
  95. GL_DEF = drivers/windows/icd/mesa.def
  96. else
  97. GL_DEF = $(LIB_NAME).def
  98. endif
  99. endif
  100. UNLINK = del $(subst /,\,$(1))
  101. ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
  102. UNLINK = $(RM) $(1)
  103. endif
  104. ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
  105. UNLINK = $(RM) $(1)
  106. endif
  107. include sources.mak
  108. CFLAGS += $(INCLUDE_DIRS)
  109. ifeq ($(X86),1)
  110. CFLAGS += -DUSE_X86_ASM
  111. CFLAGS += -DUSE_MMX_ASM
  112. CFLAGS += -DUSE_SSE_ASM
  113. CFLAGS += -DUSE_3DNOW_ASM
  114. X86_SOURCES += $(X86_API)
  115. else
  116. X86_SOURCES =
  117. endif
  118. ifeq ($(FX),1)
  119. DRIVER_SOURCES = \
  120. $(GLIDE_DRIVER_SOURCES) \
  121. drivers/windows/fx/fxwgl.c
  122. else
  123. ifeq ($(ICD),1)
  124. DRIVER_SOURCES = \
  125. drivers/windows/gdi/wmesa.c \
  126. drivers/windows/icd/icd.c
  127. else
  128. DRIVER_SOURCES = \
  129. drivers/windows/gdi/wmesa.c \
  130. drivers/windows/gdi/wgl.c
  131. endif
  132. endif
  133. SOURCES = $(MESA_SOURCES) $(GLAPI_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
  134. OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
  135. X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
  136. RESOURCE = $(GL_RES:.rc=.res)
  137. .c.o:
  138. $(CC) -o $@ $(CFLAGS) -c $<
  139. .s.o:
  140. $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
  141. .rc.res:
  142. windres -o $@ -Irc -Ocoff $<
  143. all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
  144. $(LIBDIR):
  145. mkdir -p $(LIBDIR)
  146. $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
  147. $(CC) $(LDFLAGS) -o $(LIBDIR)/$(GL_DLL) $^ $(LDLIBS)
  148. $(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GL_DEF) $^
  149. $(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GL_IMP) --def $(LIBDIR)/$(GL_DEF)
  150. $(X86_OBJECTS): x86/matypes.h
  151. x86/matypes.h: x86/gen_matypes.exe
  152. $(subst /,\,$< > $@)
  153. x86/gen_matypes.exe: x86/gen_matypes.c
  154. $(CC) -o $@ $(CFLAGS) -s $<
  155. # [dBorca]
  156. # glapi_x86.S needs some adjustments
  157. # in order to generate correct entrypoints
  158. # Trick: change the following condition to
  159. # be always false if you need C entrypoints
  160. # with USE_X86_ASM (useful for trace/debug)
  161. ifeq (1,1)
  162. x86/glapi_x86.o: x86/glapi_x86.S
  163. $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
  164. else
  165. main/dispatch.o: main/dispatch.c
  166. $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
  167. glapi/glapi.o: glapi/glapi.c
  168. $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
  169. endif
  170. # [dBorca]
  171. # if we want codegen, we have to stdcall
  172. tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S
  173. $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
  174. clean:
  175. -$(call UNLINK,glapi/*.o)
  176. -$(call UNLINK,main/*.o)
  177. -$(call UNLINK,math/*.o)
  178. -$(call UNLINK,vbo/*.o)
  179. -$(call UNLINK,shader/*.o)
  180. -$(call UNLINK,shader/slang/*.o)
  181. -$(call UNLINK,sparc/*.o)
  182. -$(call UNLINK,ppc/*.o)
  183. -$(call UNLINK,swrast/*.o)
  184. -$(call UNLINK,swrast_setup/*.o)
  185. -$(call UNLINK,tnl/*.o)
  186. -$(call UNLINK,x86/*.o)
  187. -$(call UNLINK,x86/rtasm/*.o)
  188. -$(call UNLINK,x86-64/*.o)
  189. -$(call UNLINK,drivers/common/*.o)
  190. -$(call UNLINK,drivers/glide/*.o)
  191. -$(call UNLINK,drivers/windows/fx/*.o)
  192. -$(call UNLINK,drivers/windows/fx/*.res)
  193. -$(call UNLINK,drivers/windows/gdi/*.o)
  194. -$(call UNLINK,drivers/windows/icd/*.o)