Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile調整:入力ファイルUTF-8指定、GitHash出力 #306

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions sakura_core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DEFINES= \
-DUNICODE \
-DNDEBUG
CFLAGS= -O2 \
-finput-charset=cp932 -fexec-charset=cp932 \
-finput-charset=utf-8 -fexec-charset=cp932 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ちゃんと試せてませんが「-finput-charset=utf-8」はなしでもいけてます。
「-finput-charset=utf8」だと「iconvにそんなエンコード名ないよ」と怒られます。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

まぁもともと明示的な指定があったみたいなのでそれを踏襲して utf-8 にした、という経緯があります。無くても BOM 付き UTF-8 なら自動判定してくれそうではありますね。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

問題ないっす。
-finput-charset=utf-8 を付けた場合で問題ないことも確認できてます。

-I. \
$(DEFINES) $(MYCFLAGS)
CXXFLAGS= $(CFLAGS) $(MYCXXFLAGS)
Expand Down Expand Up @@ -421,9 +421,12 @@ RCTOOL=$(RCTOOLDIR)/mrc2grc.exe
HEADERMAKETOOLDIR= ../HeaderMake
HEADERMAKE= $(HEADERMAKETOOLDIR)/HeaderMake.exe

COMMITID=`git show -s --format=%H`
SHORT_COMMITID=`git show -s --format=%h`

all: $(RCTOOL) $(HEADERMAKE) $(exe)

$(exe): Funccode_define.h Funccode_enum.h svnrev stdafx $(OBJS)
$(exe): Funccode_define.h Funccode_enum.h githash stdafx $(OBJS)
$(CXX) -o $@ $(OBJS) $(LIBS)

Funccode_define.h: Funccode_x.hsrc
Expand All @@ -432,9 +435,10 @@ Funccode_define.h: Funccode_x.hsrc
Funccode_enum.h: Funccode_x.hsrc
$(HEADERMAKE) -in=../sakura_core/Funccode_x.hsrc -out=../sakura_core/Funccode_enum.h -mode=enum -enum=EFunctionCode

svnrev:
cp svnrev_unknown.h svnrev.h
-$(SUBWCREV) ".\\" ".\svnrev_template.h" ".\svnrev.h"
githash:
echo >githash.h "#pragma once"
echo >>githash.h "#define GIT_COMMIT_HASH \"$(COMMITID)\""
echo >>githash.h "#define GIT_SHORT_COMMIT_HASH \"$(SHORT_COMMITID)\""

stdafx:
$(CXX) $(CXXFLAGS) -c StdAfx.h
Expand All @@ -449,14 +453,12 @@ $(HEADERMAKE): $(HEADERMAKETOOLDIR)/HeaderMake.cpp
$(CXX) $(CXXFLAGS) $(HEADERMAKETOOLDIR)/HeaderMake.cpp -o $@ -static-libgcc

.rc.o:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここ間違ってませんか?
rc ファイルのコンパイル結果は res ファイルです。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここは使う人が勝手に決めるものなので、間違ってるとかではないのかな、と思います。
拡張子 res は microsoft が勝手に決めた仕様ですが、これはwindowsの仕様じゃないです。
ちなみに cmakeが吐く Makefile だと .rc.obj になります。
というわけで、rc→oで問題ないんじゃないかと思います。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MinGWではリソースファイルはCOFF obj形式にコンパイルして使います。
res形式はリンクできなかったような?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうなんや

$(RCTOOL) $< sakura_grc.rc
$(RC) --language=0411 $(DEFINES) sakura_grc.rc -o $@
$(RM) sakura_grc.rc
$(RC) -c65001 --language=0411 $(DEFINES) sakura_rc.rc -o $@
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すみません。提示した修正案が間違っておりました。

-c UTF8と書かないと動かないみたいです。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なんだか自分の環境では -c65001 でも -c UTF8 でも、もしくは -c オプション入れなくても sakura_rc.o の内容は全部同じになりました。環境依存ありますかね?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-c65001 でも -c UTF8 でも

ん?-c65001-c 65001じゃなくて?
・・・コマンドラインの書き方間違ってた気配がw

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-c65001-c 65001 もどっちもイケて、どっちも同じ結果でした


clean:
$(RM) $(exe) $(OBJS) $(RCTOOL) $(HEADERMAKE) StdAfx.h.gch

depend: svnrev
depend: githash
$(CXX) -E -MM -w $(DEFINES) $(CXXFLAGS) *.cpp */*.cpp */*/*.cpp > depend.mak

.SUFFIXES: .cpp .o .rc
Expand Down