3 # Build Mesa3DGL private libmesa.a
6 include $(SRCDIR)/config/aros.cfg
8 CUR_MESADIR := src/mesa
9 include $(SRCDIR)/$(CURDIR)/../mesa.cfg
10 include $(top_srcdir)/$(CUR_MESADIR)/Makefile.sources
12 #MM- mesa3dgl-linklibs : mesa3d-linklib-mesa
14 # disable necessary warnings
15 NOWARN_FLAGS := $(MESA_NOWARNFLAGS) $(NOWARN_RETURN_TYPE) $(NOWARN_UNUSED_CONST_VARIABLE) \
16 $(NOWARN_STRICT_ALIASING) $(NOWARN_MAYBE_UNINITIALIZED) $(NOWARN_ARRAY_BOUNDS)
18 -DPACKAGE_VERSION=\"$(MESAGLVERSION)\" \
19 -DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"
20 USER_CFLAGS += $(NOWARN_FLAGS)
21 USER_CXXFLAGS += $(NOWARN_FLAGS)
24 -iquote $(top_builddir)/$(CUR_MESADIR) \
25 -iquote $(top_builddir)/$(CUR_MESADIR)/main \
26 -iquote $(top_srcdir)/src/mapi \
27 -iquote $(top_builddir)/src/compiler/glsl \
28 -iquote $(top_srcdir)/compiler/glsl \
29 -iquote $(top_builddir)/src/compiler/nir \
30 -iquote $(top_srcdir)/src/compiler/nir \
31 -iquote $(top_srcdir)/src/gallium/include \
32 -I$(top_srcdir)/$(CUR_MESADIR) \
33 -I$(top_srcdir)/$(CUR_MESADIR)/main \
34 -I$(top_srcdir)/src/gallium/auxiliary \
35 -I$(top_srcdir)/include
37 MESA_GENERATED_C_SOURCES := \
41 main/format_unpack.c \
42 program/program_parse.tab.c \
45 MESA3D_SOURCES := $(filter-out $(MESA_GENERATED_C_SOURCES),$(PROGRAM_FILES) $(PROGRAM_NIR_FILES) $(MESA_GALLIUM_FILES))
46 MESA3D_GALLIUM_CXX_SOURCES := $(filter %.cpp, $(MESA3D_SOURCES))
47 MESA3D_GALLIUM_C_SOURCES := $(filter %.c, $(MESA3D_SOURCES))
50 %mkdir_q dir="$(dir $@)"
51 $(Q)$(ECHO) "Generating $(if $(filter /%,$@),$(if $(filter $(SRCDIR)/%,$(abspath $@)),$(patsubst $(SRCDIR)/%,%,$(abspath $@)),$(patsubst $(TOP)/%,%,$(abspath $@))),$(patsubst $(SRCDIR)/%,%,$(abspath $(SRCDIR)/$(CURDIR)/$@)))"
52 $(Q)$(PRIVATE_SCRIPT) $(1) $(PRIVATE_XML) > $@
56 $(wildcard $(glapi)/*.py) \
57 $(wildcard $(glapi)/*.xml)
59 $(top_builddir)/$(CUR_MESADIR)/main/dispatch.h: PRIVATE_SCRIPT := $(PYTHON) $(glapi)/gl_table.py
60 $(top_builddir)/$(CUR_MESADIR)/main/dispatch.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
62 $(top_builddir)/$(CUR_MESADIR)/main/dispatch.h: $(dispatch_deps)
63 %mkdir_q dir="$(dir $@)"
64 $(Q)$(ECHO) "Generating $(if $(filter /%,$@),$(if $(filter $(SRCDIR)/%,$(abspath $@)),$(patsubst $(SRCDIR)/%,%,$(abspath $@)),$(patsubst $(TOP)/%,%,$(abspath $@))),$(patsubst $(SRCDIR)/%,%,$(abspath $(SRCDIR)/$(CURDIR)/$@)))"
65 $(PRIVATE_SCRIPT) -m remap_table $(PRIVATE_XML) > $@
67 $(top_builddir)/$(CUR_MESADIR)/main/remap_helper.h: PRIVATE_SCRIPT := $(PYTHON) $(glapi)/remap_helper.py
68 $(top_builddir)/$(CUR_MESADIR)/main/remap_helper.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
70 $(top_builddir)/$(CUR_MESADIR)/main/remap_helper.h: $(dispatch_deps)
71 %mkdir_q dir="$(dir $@)"
72 $(Q)$(ECHO) "Generating $(if $(filter /%,$@),$(if $(filter $(SRCDIR)/%,$(abspath $@)),$(patsubst $(SRCDIR)/%,%,$(abspath $@)),$(patsubst $(TOP)/%,%,$(abspath $@))),$(patsubst $(SRCDIR)/%,%,$(abspath $(SRCDIR)/$(CURDIR)/$@)))"
73 $(PRIVATE_SCRIPT) $(PRIVATE_XML) > $@
75 $(top_builddir)/$(CUR_MESADIR)/main/enums.c: PRIVATE_SCRIPT := $(PYTHON) $(glapi)/gl_enums.py
76 $(top_builddir)/$(CUR_MESADIR)/main/enums.c: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
77 $(top_builddir)/$(CUR_MESADIR)/main/enums.c: $(dispatch_deps)
80 $(top_builddir)/$(CUR_MESADIR)/main/api_exec.c: PRIVATE_SCRIPT := $(PYTHON) $(glapi)/gl_genexec.py
81 $(top_builddir)/$(CUR_MESADIR)/main/api_exec.c: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
82 $(top_builddir)/$(CUR_MESADIR)/main/api_exec.c: $(dispatch_deps)
85 GET_HASH_GEN := $(top_srcdir)/$(CUR_MESADIR)/main/get_hash_generator.py
86 $(top_builddir)/$(CUR_MESADIR)/main/get_hash.h: PRIVATE_SCRIPT := $(PYTHON) $(GET_HASH_GEN)
87 $(top_builddir)/$(CUR_MESADIR)/main/get_hash.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
88 $(top_builddir)/$(CUR_MESADIR)/main/get_hash.h: $(glapi)/gl_and_es_API.xml \
89 $(top_srcdir)/$(CUR_MESADIR)/main/get_hash_params.py $(GET_HASH_GEN)
92 FORMAT_INFO := $(top_srcdir)/$(CUR_MESADIR)/main/format_info.py
94 $(top_srcdir)/$(CUR_MESADIR)/main/formats.csv \
95 $(top_srcdir)/$(CUR_MESADIR)/main/format_parser.py \
98 $(top_builddir)/$(CUR_MESADIR)/main/format_info.h: PRIVATE_SCRIPT := $(PYTHON) $(FORMAT_INFO)
99 $(top_builddir)/$(CUR_MESADIR)/main/format_info.h: PRIVATE_XML :=
100 $(top_builddir)/$(CUR_MESADIR)/main/format_info.h: $(format_info_deps)
103 FORMAT_PACK := $(top_srcdir)/$(CUR_MESADIR)/main/format_pack.py
104 format_pack_deps := \
105 $(top_srcdir)/$(CUR_MESADIR)/main/formats.csv \
106 $(top_srcdir)/$(CUR_MESADIR)/main/format_parser.py \
109 $(top_builddir)/$(CUR_MESADIR)/main/format_pack.c: PRIVATE_SCRIPT := $(PYTHON) $(FORMAT_PACK)
110 $(top_builddir)/$(CUR_MESADIR)/main/format_pack.c: PRIVATE_XML :=
111 $(top_builddir)/$(CUR_MESADIR)/main/format_pack.c: $(format_pack_deps)
114 FORMAT_UNPACK := $(top_srcdir)/$(CUR_MESADIR)/main/format_unpack.py
115 format_unpack_deps := \
116 $(top_srcdir)/$(CUR_MESADIR)/main/formats.csv \
117 $(top_srcdir)/$(CUR_MESADIR)/main/format_parser.py \
120 $(top_builddir)/$(CUR_MESADIR)/main/format_unpack.c: PRIVATE_SCRIPT := $(PYTHON) $(FORMAT_UNPACK)
121 $(top_builddir)/$(CUR_MESADIR)/main/format_unpack.c: PRIVATE_XML :=
122 $(top_builddir)/$(CUR_MESADIR)/main/format_unpack.c: $(format_unpack_deps)
125 $(top_builddir)/$(CUR_MESADIR)/main/git_sha1.h.tmp:
126 $(Q)$(IF) $(TEST) -d $(top_srcdir)/.git; then \
127 $(IF) which git > /dev/null; then \
128 git --git-dir=$(top_srcdir)/.git log -n 1 --oneline | \
129 sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
130 > $(top_builddir)/$(CUR_MESADIR)/main/git_sha1.h.tmp ; \
133 $(ECHO) "#define MESA_GIT_SHA1 \"\"" > $@ ;\
136 $(top_builddir)/$(CUR_MESADIR)/main/git_sha1.h : $(top_builddir)/$(CUR_MESADIR)/main/git_sha1.h.tmp
137 $(Q)$(ECHO) "Caching repository version in $(CUR_MESADIR)/main/git_sha1.h"
138 $(Q)$(IF) ! cmp -s $(top_builddir)/$(CUR_MESADIR)/main/git_sha1.h.tmp $(top_builddir)/$(CUR_MESADIR)/main/git_sha1.h; then \
139 mv $(top_builddir)/$(CUR_MESADIR)/main/git_sha1.h.tmp $(top_builddir)/$(CUR_MESADIR)/main/git_sha1.h ;\
141 rm $(top_builddir)/$(CUR_MESADIR)/main/git_sha1.h.tmp ;\
144 $(top_builddir)/$(CUR_MESADIR)/program/lex.yy.c: $(top_srcdir)/$(CUR_MESADIR)/program/program_lexer.l
145 %mkdir_q dir="$(dir $@)"
146 $(Q)$(ECHO) "Generating $(if $(filter /%,$@),$(if $(filter $(SRCDIR)/%,$(abspath $@)),$(patsubst $(SRCDIR)/%,%,$(abspath $@)),$(patsubst $(TOP)/%,%,$(abspath $@))),$(patsubst $(SRCDIR)/%,%,$(abspath $(SRCDIR)/$(CURDIR)/$@)))"
147 $(Q)$(LEX) $(FFLAGS) --never-interactive --outfile=$@ $<
149 $(top_builddir)/$(CUR_MESADIR)/program/program_parse.tab.c $(top_builddir)/$(CUR_MESADIR)/program/program_parse.tab.h: $(top_srcdir)/$(CUR_MESADIR)/program/program_parse.y
150 %mkdir_q dir="$(dir $@)"
151 $(Q)$(ECHO) "Generating $(if $(filter /%,$@),$(if $(filter $(SRCDIR)/%,$(abspath $@)),$(patsubst $(SRCDIR)/%,%,$(abspath $@)),$(patsubst $(TOP)/%,%,$(abspath $@))),$(patsubst $(SRCDIR)/%,%,$(abspath $(SRCDIR)/$(CURDIR)/$@)))"
152 $(Q)$(BISON) $(BFLAGS) -p "_mesa_program_" -v -d --output=$(top_builddir)/$(CUR_MESADIR)/program/program_parse.tab.c $<
154 MESA3DGL_MESA_GENERATED_C_SOURCES := \
155 $(addprefix $(top_builddir)/$(CUR_MESADIR)/,$(MESA_GENERATED_C_SOURCES))
157 MESA3DGL_MESA_GENERATED_C_HEADERS := \
158 $(top_builddir)/$(CUR_MESADIR)/main/dispatch.h \
159 $(top_builddir)/$(CUR_MESADIR)/main/remap_helper.h \
160 $(top_builddir)/$(CUR_MESADIR)/main/get_hash.h \
161 $(top_builddir)/$(CUR_MESADIR)/main/git_sha1.h \
162 $(top_builddir)/$(CUR_MESADIR)/main/format_info.h
164 MESA3DGL_MESA_C_SOURCES := \
165 $(wildcard $(addprefix $(top_srcdir)/$(CUR_MESADIR)/, $(MESA3D_GALLIUM_C_SOURCES))) \
166 $(MESA3DGL_MESA_GENERATED_C_SOURCES)
168 MESA3DGL_MESA_SOURCES_C := $(MESA3DGL_MESA_C_SOURCES:.c=)
170 MESA3DGL_MESA_CXX_SOURCES := \
171 $(wildcard $(addprefix $(top_srcdir)/$(CUR_MESADIR)/, $(MESA3D_GALLIUM_CXX_SOURCES)))
173 MESA3DGL_MESA_SOURCES_CXX := $(MESA3DGL_MESA_CXX_SOURCES:.cpp=)
176 mesa3d-linklib-mesa-generated : $(MESA3DGL_MESA_GENERATED_C_HEADERS) $(MESA3DGL_MESA_GENERATED_C_SOURCES)
178 #MM mesa3d-linklib-mesa : mesa3d-linklib-mesa-generated
180 %build_linklib mmake=mesa3d-linklib-mesa libname=mesa libdir="$(top_libdir)" objdir="$(top_builddir)/$(CUR_MESADIR)" files="$(MESA3DGL_MESA_SOURCES_C)" cxxfiles="$(MESA3DGL_MESA_SOURCES_CXX)"