From 73bf608efc913589992903ebdbab1da5c115b49d Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 30 Jul 2014 15:37:50 +0200 Subject: MacOSX : Correct issue of compiling assembly files in both 32-bit and 64-bit mode. Modify Makefiles to correct compilation process using latest Xcode. --- src/Build/Include/Makefile.inc | 17 ++++++++++++----- src/Main/Main.make | 3 +++ src/Makefile | 39 ++++++++++++++++++++++++--------------- src/Volume/Volume.make | 19 +++++++++++++++---- 4 files changed, 54 insertions(+), 24 deletions(-) diff --git a/src/Build/Include/Makefile.inc b/src/Build/Include/Makefile.inc index 39395e95..a6fd58a2 100644 --- a/src/Build/Include/Makefile.inc +++ b/src/Build/Include/Makefile.inc @@ -10,7 +10,7 @@ $(NAME): $(NAME).a clean: @echo Cleaning $(NAME) - rm -f $(APPNAME) $(NAME).a $(OBJS) $(OBJS:.o=.d) *.gch + rm -f $(APPNAME) $(NAME).a $(OBJS) $(OBJSEX) $(OBJS:.o=.d) *.gch %.o: %.c @echo Compiling $($(APPNAME).app/Contents/PkgInfo sed -e 's/_VERSION_/$(patsubst %a,%.1,$(patsubst %b,%.2,$(TC_VERSION)))/' ../Build/Resources/MacOSX/Info.plist.xml >$(APPNAME).app/Contents/Info.plist + codesign -s "Developer ID Application: Mounir IDRASSI" $(APPNAME).app + rm -f $(APPNAME).dmg + hdiutil create -srcfolder $(APPNAME).app -volname "VeraCrypt $(TC_VERSION) for Mac OS X $(VC_OSX_TARGET) and later" $(APPNAME)_$(TC_VERSION).dmg endif ifeq "$(PLATFORM)" "Linux" diff --git a/src/Makefile b/src/Makefile index 33d22a48..bd1b195d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -130,10 +130,10 @@ endif ifneq (,$(filter i386 i486 i586 i686 x86,$(ARCH))) CPU_ARCH = x86 - ASM_OBJ_FORMAT = elf32 + ASFLAGS += -f elf32 else ifneq (,$(filter x86_64 x86-64 amd64 x64,$(ARCH))) CPU_ARCH = x64 - ASM_OBJ_FORMAT = elf64 + ASFLAGS += -f elf64 endif ifeq "$(origin NOASM)" "command line" @@ -177,20 +177,27 @@ ifeq "$(shell uname -s)" "Darwin" PLATFORM := MacOSX APPNAME := VeraCrypt + + export VC_OSX_TARGET ?= 10.7 + + #check to see if XCode 3 path exists.Otherwise, use XCode 4 path + VC_OSX_SDK := /Developer/SDKs/MacOSX$(VC_OSX_TARGET).sdk + ifeq ($(wildcard $(VC_OSX_SDK)/SDKSettings.plist),) + VC_OSX_SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(VC_OSX_TARGET).sdk + endif - TC_OSX_SDK ?= /Developer/SDKs/MacOSX10.4u.sdk - CC := gcc-4.0 - CXX := g++-4.0 + CC := gcc + CXX := g++ - C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -mmacosx-version-min=10.4 -isysroot $(TC_OSX_SDK) - LFLAGS += -mmacosx-version-min=10.4 -Wl,-syslibroot $(TC_OSX_SDK) - WX_CONFIGURE_FLAGS += --with-macosx-version-min=10.4 --with-macosx-sdk=$(TC_OSX_SDK) + C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -mmacosx-version-min=$(VC_OSX_TARGET) -isysroot $(VC_OSX_SDK) + LFLAGS += -mmacosx-version-min=$(VC_OSX_TARGET) -Wl,-syslibroot $(VC_OSX_SDK) + WX_CONFIGURE_FLAGS += --with-macosx-version-min=$(VC_OSX_TARGET) --with-macosx-sdk=$(VC_OSX_SDK) ifeq "$(CPU_ARCH)" "x64" CPU_ARCH = x86 endif - ASM_OBJ_FORMAT = macho + AS := $(BASE_DIR)/Build/Tools/MacOSX/nasm ASFLAGS += --prefix _ ifeq "$(TC_BUILD_CONFIG)" "Release" @@ -200,10 +207,10 @@ ifeq "$(shell uname -s)" "Darwin" S := $(C_CXX_FLAGS) C_CXX_FLAGS = $(subst -MMD,,$(S)) - C_CXX_FLAGS += -gfull -arch i386 -arch ppc - LFLAGS += -Wl,-dead_strip -arch i386 -arch ppc + C_CXX_FLAGS += -gfull -arch i386 -arch x86_64 + LFLAGS += -Wl,-dead_strip -arch i386 -arch x86_64 - WX_CONFIGURE_FLAGS += --enable-universal_binary + WX_CONFIGURE_FLAGS += --enable-universal_binary=i386,x86_64 WXCONFIG_CFLAGS += -gfull WXCONFIG_CXXFLAGS += -gfull @@ -243,12 +250,11 @@ endif CFLAGS := $(C_CXX_FLAGS) $(CFLAGS) $(TC_EXTRA_CFLAGS) CXXFLAGS := $(C_CXX_FLAGS) $(CXXFLAGS) $(TC_EXTRA_CXXFLAGS) -ASFLAGS += -f $(ASM_OBJ_FORMAT) LFLAGS := $(LFLAGS) $(TC_EXTRA_LFLAGS) WX_CONFIGURE_FLAGS += --enable-unicode -disable-shared --disable-dependency-tracking --disable-compat26 --enable-exceptions --enable-std_string --enable-dataobj --enable-mimetype \ --disable-protocol --disable-protocols --disable-url --disable-ipc --disable-sockets --disable-fs_inet --disable-ole --disable-docview --disable-clipboard \ - --disable-help --disable-html --disable-mshtmlhelp --disable-htmlhelp --disable-mdi --disable-metafile --disable-webkit \ + --disable-help --disable-html --disable-mshtmlhelp --disable-htmlhelp --disable-mdi --disable-metafile --disable-webkit --disable-webview \ --disable-xrc --disable-aui --disable-postscript --disable-printarch \ --disable-arcstream --disable-fs_archive --disable-fs_zip --disable-tarstream --disable-zipstream \ --disable-animatectrl --disable-bmpcombobox --disable-calendar --disable-caret --disable-checklst --disable-collpane --disable-colourpicker --disable-comboctrl \ @@ -256,7 +262,7 @@ WX_CONFIGURE_FLAGS += --enable-unicode -disable-shared --disable-dependency-trac --disable-listbook --disable-odcombobox --disable-sash --disable-searchctrl --disable-slider --disable-splitter --disable-togglebtn \ --disable-toolbar --disable-tbarnative --disable-treebook --disable-toolbook --disable-tipwindow --disable-popupwin \ --disable-commondlg --disable-aboutdlg --disable-coldlg --disable-finddlg --disable-fontdlg --disable-numberdlg --disable-splash \ - --disable-tipdlg --disable-progressdlg --disable-wizarddlg --disable-miniframe --disable-tooltips --disable-splines --disable-palette \ + --disable-tipdlg --disable-progressdlg --disable-wizarddlg --disable-miniframe --disable-splines --disable-palette \ --disable-richtext --disable-dialupman --disable-debugreport --disable-filesystem --disable-rearrangectrl --disable-treelist --disable-richmsgdlg \ --disable-richtooltip --disable-propgrid --disable-stc --without-libnotify \ --without-gtkprint --without-gnomevfs --disable-fsvolume --disable-fswatcher \ @@ -264,6 +270,9 @@ WX_CONFIGURE_FLAGS += --enable-unicode -disable-shared --disable-dependency-trac --disable-gif --disable-pcx --disable-tga --disable-iff --disable-gif --disable-pnm --disable-svg \ --without-expat --without-libtiff --without-libjpeg --without-libpng -without-regex --without-zlib +ifeq "$(PLATFORM)" "Linux" +WX_CONFIGURE_FLAGS += --disable-tooltips +endif #------ Project build ------ diff --git a/src/Volume/Volume.make b/src/Volume/Volume.make index 25c18441..212b1474 100644 --- a/src/Volume/Volume.make +++ b/src/Volume/Volume.make @@ -7,6 +7,7 @@ # OBJS := +OBJSEX := OBJS += Cipher.o OBJS += EncryptionAlgorithm.o OBJS += EncryptionMode.o @@ -24,12 +25,13 @@ OBJS += VolumeLayout.o OBJS += VolumePassword.o OBJS += VolumePasswordCache.o -ifeq "$(CPU_ARCH)" "x86" +ifeq "$(PLATFORM)" "MacOSX" + OBJSEX += ../Crypto/Aes_asm.oo + OBJS += ../Crypto/Aes_hw_cpu.o + OBJS += ../Crypto/Aescrypt.o +else ifeq "$(CPU_ARCH)" "x86" OBJS += ../Crypto/Aes_x86.o OBJS += ../Crypto/Aes_hw_cpu.o - ifeq "$(PLATFORM)" "MacOSX" - OBJS += ../Crypto/Aescrypt.o - endif else ifeq "$(CPU_ARCH)" "x64" OBJS += ../Crypto/Aes_x64.o OBJS += ../Crypto/Aes_hw_cpu.o @@ -53,4 +55,13 @@ OBJS += ../Common/SecurityToken.o VolumeLibrary: Volume.a +ifeq "$(PLATFORM)" "MacOSX" +../Crypto/Aes_asm.oo: ../Crypto/Aes_x86.asm ../Crypto/Aes_x64.asm + @echo Assembling $(