aboutsummaryrefslogtreecommitdiffhomepage
path: root/gen/Makefile
blob: 9442f0d7e3370616f71f9051e61f93883e7dc871 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
TARGET=../xbyak/xbyak_mnemonic.h
BIN=sortline gen_code gen_avx512
CFLAGS=-I../ -O2 -DXBYAK_NO_OP_NAMES -Wall -Wextra -Wno-missing-field-initializers $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
all: $(TARGET) ../CMakeLists.txt ../meson.build
sortline: sortline.cpp
	$(CXX) $(CFLAGS) $< -o $@
gen_code: gen_code.cpp ../xbyak/xbyak.h avx_type.hpp
	$(CXX) $(CFLAGS) $< -o $@
gen_avx512: gen_avx512.cpp ../xbyak/xbyak.h avx_type.hpp
	$(CXX) $(CFLAGS) $< -o $@

$(TARGET): $(BIN)
	./gen_code | ./sortline > $@
	echo "#ifdef XBYAK_ENABLE_OMITTED_OPERAND" >> $@
	./gen_code omit | ./sortline >> $@
	echo "#endif" >>$@
	./gen_code fixed >> $@
	echo "#ifndef XBYAK_DISABLE_AVX512" >> $@
	./gen_avx512 | ./sortline >> $@
	echo "#ifdef XBYAK64" >> $@
	./gen_avx512 64 | ./sortline >> $@
	echo "#endif" >> $@
	echo "#endif" >> $@

VER=$(shell head -n 1 ../xbyak/xbyak_mnemonic.h|grep -o "[0-9.]*")
../CMakeLists.txt: $(TARGET)
	sed -i -e 's/CXX VERSION [0-9.]*/CXX VERSION $(VER)/' $@

../meson.build: $(TARGET)
	sed -i -e "s/version: '[0-9.]*',/version: '$(VER)',/" $@

clean:
	$(RM) $(BIN) $(TARGET)