Revision: 9776 https://osdn.net/projects/ttssh2/scm/svn/commits/9776 Author: zmatsuo Date: 2022-02-24 01:42:46 +0900 (Thu, 24 Feb 2022) Log Message: ----------- makeで32,64bit版cygtermバイナリを作成 - 実験的cmakeビルドではなく、makeを使ったビルド - build.bat を実行すると作成できる Modified Paths: -------------- branches/cygterm/cygwin/cygterm/Makefile branches/cygterm/cygwin/cygterm/toolchain_i686-cygwin.cmake Added Paths: ----------- branches/cygterm/cygwin/cygterm/build.bat branches/cygterm/cygwin/cygterm/build.md -------------- next part -------------- Modified: branches/cygterm/cygwin/cygterm/Makefile =================================================================== --- branches/cygterm/cygwin/cygterm/Makefile 2022-02-23 16:36:05 UTC (rev 9775) +++ branches/cygterm/cygwin/cygterm/Makefile 2022-02-23 16:42:46 UTC (rev 9776) @@ -3,6 +3,24 @@ BINDIR = $(HOME)/bin CC = gcc +CXX = g++ +RC = windres +UNAME_A = $(shell uname -a) + +ifneq (,$(findstring x86_64, "$(UNAME_A)")) +ifneq (,$(findstring x86_64, $(RC))) +# x86_64-pc-cygwin-windres is not exists +# use windres, when x86_64 env +override RC= windres +endif +else +ifneq (,$(findstring i686, $(RC))) +# i686-pc-cygwin-windres is not exsit +# use windres, when i686 env +override RC= windres +endif +endif + CFLAGS = -D_GNU_SOURCE -O2 -fno-exceptions -DUNICODE -D_UNICODE #CFLAGS = -D_GNU_SOURCE -O2 -fno-exceptions CXXFLAGS = $(CFLAGS) @@ -10,33 +28,35 @@ EXE = cygterm.exe SRC = \ - $(EXE:.exe=.cc) \ + cygterm.cc \ cygterm_cfg.cc \ cygterm_cfg.h \ sub.cpp \ sub.h -CFG = $(EXE:.exe=.cfg) -RES = $(EXE:.exe=.res) -ICO = $(EXE:.exe=.ico) -RC = $(EXE:.exe=.rc) +CFG = cygterm.cfg +RES = cygterm.res +ICO = cygterm.ico +SRC_RC = cygterm.rc ARCHIVE = cygterm+.tar.gz -.PHONY: all clean install uninstall +.PHONY: all clean install uninstall cygterm_x86_64 cygterm_i686 -all : $(EXE) $(ARCHIVE) +all : $(EXE) +archive : $(ARCHIVE) + $(EXE) : cygterm.o cygterm_cfg.o sub.o $(RES) $(CC) $(CFLAGS) $(LDFLAGS) -o $(EXE) $^ -lole32 strip $(EXE) -$(RES): $(RC) - windres -O coff -o $(RES) $(RC) +$(RES): $(SRC_RC) $(ICO) + $(RC) -O coff -o $(RES) $(SRC_RC) -$(RC): - echo 'icon ICON $(ICO)' > $(RC) +$(SRC_RC): + echo 'icon ICON $(ICO)' > $(SRC_RC) clean : - rm -f $(EXE) $(RC) $(RES) $(ARCHIVE) *.o *.obj + rm -f $(EXE) $(SRC_RC) $(RES) $(ARCHIVE) *.o *.obj install : $(EXE) @ install -v $(EXE) $(BINDIR)/$(EXE) @@ -62,3 +82,11 @@ cygterm.o: cygterm.cc sub.h cygterm_cfg.h cygterm_cfg.o: cygterm_cfg.cc cygterm_cfg.h sub.o: sub.cpp sub.h + +# call sub make +cygterm_x86_64: + make CC=x86_64-pc-cygwin-gcc CXX=x86_64-pc-cygwin-g++ RC=x86_64-pc-cygwin-windres EXE=cygterm_x86_64.exe + +cygterm_i686: + make CC=i686-pc-cygwin-gcc CXX=i686-pc-cygwin-g++ RC=i686-pc-cygwin-windres clean all EXE=cygterm_i686.exe + Added: branches/cygterm/cygwin/cygterm/build.bat =================================================================== --- branches/cygterm/cygwin/cygterm/build.bat (rev 0) +++ branches/cygterm/cygwin/cygterm/build.bat 2022-02-23 16:42:46 UTC (rev 9776) @@ -0,0 +1,10 @@ +setlocal +rem PATH=c:\cygwin\bin +PATH=c:\cygwin64\bin +uname -a > build_info.txt +make EXE=cygterm_i686.exe clean +make -j cygterm_i686 +make EXE=cygterm_x86_64.exe clean +make -j cygterm_x86_64 +file *.exe >> build_info.txt +pause Added: branches/cygterm/cygwin/cygterm/build.md =================================================================== --- branches/cygterm/cygwin/cygterm/build.md (rev 0) +++ branches/cygterm/cygwin/cygterm/build.md 2022-02-23 16:42:46 UTC (rev 9776) @@ -0,0 +1,27 @@ +# cygtermのビルドについて + +- リリース時に64bitと32bit両方をビルドしたい +- 64bit Cygwinを使いたい + - 近い将来 32bit Cygwinがなくなる + +## 準備 + +64bit Cygwinの32bit Cygwinクロスコンパイルを利用する +(32bit Cygwinの64bit Cygwinクロスコンパイルも利用できる) + +- 64bit Cygwin時(将来はこれだけになる) +- 次のパッケージをインストール + - cygwin32-gcc-core + - cygwin32-gcc-g++ + - `setup-x86_64.exe --quiet-mode --packages cygwin32-gcc-g++ --packages cygwin32-gcc-core` + +- 32bit Cygwin時(近い将来なくなる) +- 次のパッケージをインストール + - cygwin64-gcc-core + - cygwin64-gcc-g++ + - `setup-x86.exe --quiet-mode --packages cygwin64-gcc-g++ --packages cygwin64-gcc-core` + +## ビルド + +- 次のファイルを実行 + - `build.bat` Modified: branches/cygterm/cygwin/cygterm/toolchain_i686-cygwin.cmake =================================================================== --- branches/cygterm/cygwin/cygterm/toolchain_i686-cygwin.cmake 2022-02-23 16:36:05 UTC (rev 9775) +++ branches/cygterm/cygwin/cygterm/toolchain_i686-cygwin.cmake 2022-02-23 16:42:46 UTC (rev 9776) @@ -1,7 +1,7 @@ set(CMAKE_SYSROOT /usr/i686-pc-cygwin/sys-root) -set(CMAKE_RC_COMPILER /bin/i686-pc-cygwin-windres) set(CMAKE_C_COMPILER i686-pc-cygwin-gcc) set(CMAKE_CXX_COMPILER i686-pc-cygwin-g++) +set(CMAKE_RC_COMPILER i686-pc-cygwin-windres) if(NOT EXISTS ${CMAKE_SYSROOT}) unset(CMAKE_RC_COMPILER) unset(CMAKE_SYSROOT)