"Fossies" - the Fresh Open Source Software Archive

Member "src/Makefile" (10 Oct 2018, 12215 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "Makefile": 1.22_Source_vs_1.23_Source.

    1 #
    2 # Derived from source code of TrueCrypt 7.1a, which is
    3 # Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
    4 # by the TrueCrypt License 3.0.
    5 #
    6 # Modifications and additions to the original source code (contained in this file)
    7 # and all other portions of this file are Copyright (c) 2013-2017 IDRIX
    8 # and are governed by the Apache License 2.0 the full text of which is
    9 # contained in the file License.txt included in VeraCrypt binary and source
   10 # code distribution packages.
   11 #
   12 
   13 #------ Command line arguments ------
   14 # DEBUG:		Disable optimizations and enable debugging checks
   15 # DEBUGGER:		Enable debugging information for use by debuggers
   16 # NOASM:		Exclude modules requiring assembler
   17 # NOGUI:		Disable graphical user interface (build console-only application)
   18 # NOSTRIP:		Do not strip release binary
   19 # NOTEST:		Do not test release binary
   20 # RESOURCEDIR:	Run-time resource directory
   21 # VERBOSE:		Enable verbose messages
   22 # WXSTATIC:		Use static wxWidgets library
   23 # SSSE3:		Enable SSSE3 support in compiler
   24 # SSE41:		Enable SSE4.1 support in compiler
   25 # NOSSE2:		Disable SEE2 support in compiler
   26 
   27 #------ Targets ------
   28 # all
   29 # clean
   30 # wxbuild:		Configure and build wxWidgets - source code must be located at $(WX_ROOT)
   31 
   32 
   33 #------ Build configuration ------
   34 
   35 export APPNAME := veracrypt
   36 export BASE_DIR := $(CURDIR)
   37 export BUILD_INC := $(BASE_DIR)/Build/Include
   38 
   39 export AR ?= ar
   40 export CC ?= gcc
   41 export CXX ?= g++
   42 export AS := yasm
   43 export RANLIB ?= ranlib
   44 
   45 export CFLAGS := -Wall
   46 export CXXFLAGS := -Wall -Wno-unused-parameter
   47 C_CXX_FLAGS := -MMD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -I$(BASE_DIR) -I$(BASE_DIR)/Crypto
   48 export ASFLAGS := -D __GNUC__ -D __YASM__
   49 export LFLAGS :=
   50 
   51 export PKG_CONFIG_PATH ?= /usr/local/lib/pkgconfig
   52 
   53 export WX_CONFIG ?= wx-config
   54 export WX_CONFIG_ARGS := --unicode
   55 WX_CONFIGURE_FLAGS :=
   56 export WXCONFIG_CFLAGS :=
   57 export WXCONFIG_CXXFLAGS :=
   58 WX_ROOT ?= ..
   59 
   60 
   61 export TC_BUILD_CONFIG := Release
   62 
   63 ifeq "$(origin DEBUG)" "command line"
   64 	ifneq "$(DEBUG)" "0"
   65 		TC_BUILD_CONFIG := Debug
   66 	endif
   67 endif
   68 
   69 ifeq "$(origin NOGUI)" "command line"
   70 	export TC_NO_GUI := 1
   71 	C_CXX_FLAGS += -DTC_NO_GUI
   72 	WX_CONFIGURE_FLAGS += --disable-gui
   73 endif
   74 
   75 ifdef PKCS11_INC
   76 	C_CXX_FLAGS += -I$(PKCS11_INC)
   77 else
   78 	C_CXX_FLAGS += -I$(CURDIR)/PKCS11
   79 endif
   80 
   81 ifeq "$(origin RESOURCEDIR)" "command line"
   82 	C_CXX_FLAGS += -DTC_RESOURCE_DIR="$(RESOURCEDIR)"
   83 endif
   84 
   85 ifneq "$(origin VERBOSE)" "command line"
   86 	MAKEFLAGS += -s
   87 endif
   88 
   89 ifeq "$(origin WXSTATIC)" "command line"
   90 	export VC_WX_STATIC := 1
   91 	WX_CONFIG = $(WX_BUILD_DIR)/wx-config
   92 	WX_CONFIG_ARGS += --static
   93 endif
   94 
   95 
   96 #------ Release configuration ------
   97 
   98 ifeq "$(TC_BUILD_CONFIG)" "Release"
   99 
  100 	C_CXX_FLAGS += -O2 -fno-strict-aliasing  # Do not enable strict aliasing
  101 	export WX_BUILD_DIR ?= $(BASE_DIR)/wxrelease
  102 	WX_CONFIGURE_FLAGS += --disable-debug_flag --disable-debug_gdb --disable-debug_info
  103 
  104 else
  105 
  106 #------ Debug configuration ------
  107 
  108 	C_CXX_FLAGS += -DDEBUG
  109 	CXXFLAGS += -fno-default-inline -Wno-unused-function -Wno-unused-variable
  110 	export WX_BUILD_DIR ?= $(BASE_DIR)/wxdebug
  111 	WX_CONFIGURE_FLAGS += --enable-debug_flag --disable-debug_gdb --disable-debug_info
  112 
  113 endif
  114 
  115 
  116 #------ Debugger configuration ------
  117 
  118 ifeq "$(origin DEBUGGER)" "command line"
  119 
  120 	C_CXX_FLAGS += -ggdb
  121 	WX_CONFIGURE_FLAGS += --enable-debug_gdb --enable-debug_info
  122 
  123 endif
  124 
  125 
  126 #------ Platform configuration ------
  127 
  128 export PLATFORM := "Unknown"
  129 export PLATFORM_ARCH := "Unknown"
  130 export PLATFORM_UNSUPPORTED := 0
  131 
  132 export CPU_ARCH ?= unknown
  133 export SIMD_SUPPORTED := 0
  134 
  135 ARCH = $(shell uname -m)
  136 
  137 ifneq (,$(filter i386 i486 i586 i686 x86,$(ARCH)))
  138 	CPU_ARCH = x86
  139     ASFLAGS += -f elf32 -D __BITS__=32
  140 else ifneq (,$(filter x86_64 x86-64 amd64 x64,$(ARCH)))
  141 	CPU_ARCH = x64
  142     ASFLAGS += -f elf64 -D __BITS__=64
  143 else ifneq (,$(filter armv7l,$(ARCH)))
  144 	PLATFORM_ARCH := armv7
  145 	CPU_ARCH = armv7
  146 endif
  147 
  148 ifeq "$(origin NOASM)" "command line"
  149 	CPU_ARCH = unknown
  150 endif
  151 
  152 ifeq "$(CPU_ARCH)" "x86"
  153 	PLATFORM_ARCH := i386
  154 	SIMD_SUPPORTED := 1
  155 	C_CXX_FLAGS += -D TC_ARCH_X86
  156 else ifeq "$(CPU_ARCH)" "x64"
  157 	PLATFORM_ARCH := amd64
  158 	SIMD_SUPPORTED := 1
  159 	C_CXX_FLAGS += -D TC_ARCH_X64
  160 endif
  161 
  162 ifeq "$(origin NOSSE2)" "command line"
  163 	SIMD_SUPPORTED := 0
  164 endif
  165 
  166 
  167 #------ Linux configuration ------
  168 
  169 ifeq "$(shell uname -s)" "Linux"
  170 
  171 	PLATFORM := Linux
  172 	C_CXX_FLAGS += -DTC_UNIX -DTC_LINUX
  173 	
  174 	ifeq "$(SIMD_SUPPORTED)" "1"
  175 		CFLAGS += -msse2
  176 		CXXFLAGS += -msse2
  177 
  178 		GCC_GTEQ_440 := $(shell expr `gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 40400)
  179 		GCC_GTEQ_430 := $(shell expr `gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 40300)
  180 		ifeq "$(GCC_GTEQ_440)" "1"
  181 			CFLAGS += -maes
  182 			CXXFLAGS += -maes
  183 		endif
  184 
  185 		ifeq "$(GCC_GTEQ_430)" "1"
  186 			ifeq "$(origin SSSE3)" "command line"
  187 				CFLAGS += -mssse3
  188 				CXXFLAGS += -mssse3
  189 			endif
  190 
  191 			ifeq "$(origin SSE41)" "command line"
  192 				CFLAGS += -mssse3 -msse4.1
  193 				CXXFLAGS += -mssse3 -msse4.1
  194 			endif
  195 		endif
  196 	endif
  197 
  198 	ifeq "$(TC_BUILD_CONFIG)" "Release"
  199 		C_CXX_FLAGS += -fdata-sections -ffunction-sections -fpie
  200 		LFLAGS += -Wl,--gc-sections -pie
  201 
  202 		ifneq "$(shell ld --help 2>&1 | grep sysv | wc -l)" "0"
  203 			LFLAGS += -Wl,--hash-style=sysv
  204 		endif
  205 
  206 		WXCONFIG_CFLAGS += -fdata-sections -ffunction-sections -fpie
  207 		WXCONFIG_CXXFLAGS += -fdata-sections -ffunction-sections -fpie
  208 	endif
  209 
  210 	ifneq "$(origin WXSTATIC)" "command line"
  211 		LFLAGS += -ldl
  212 	else
  213 		GCC5USED := $(shell expr `gcc -dumpversion | cut -f1 -d.` \>= 5)
  214 		ifeq "$(GCC5USED)" "1"
  215 			CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
  216 			WXCONFIG_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
  217 		endif
  218 	endif
  219 	
  220 	ifeq "$(origin NOSSE2)" "command line"
  221 		CFLAGS += -mno-sse2
  222 		CXXFLAGS += -mno-sse2
  223 		WXCONFIG_CFLAGS += -mno-sse2
  224 		WXCONFIG_CXXFLAGS += -mno-sse2
  225 	endif
  226 
  227 endif
  228 
  229 #------ Mac OS X configuration ------
  230 
  231 ifeq "$(shell uname -s)" "Darwin"
  232 
  233 	PLATFORM := MacOSX
  234 	APPNAME := VeraCrypt
  235 
  236 	export VC_OSX_TARGET ?= 10.7
  237 
  238 	#check to see if XCode 3 path exists.Otherwise, use XCode 4 path
  239 	VC_OSX_SDK  := /Developer/SDKs/MacOSX$(VC_OSX_TARGET).sdk
  240 	ifeq ($(wildcard $(VC_OSX_SDK)/SDKSettings.plist),)
  241 		VC_OSX_SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(VC_OSX_TARGET).sdk
  242 	endif
  243 
  244 	CC := gcc
  245 	CXX := g++
  246 
  247 	C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -mmacosx-version-min=$(VC_OSX_TARGET) -isysroot $(VC_OSX_SDK)
  248 	LFLAGS += -mmacosx-version-min=$(VC_OSX_TARGET) -Wl,-syslibroot $(VC_OSX_SDK)
  249 	WX_CONFIGURE_FLAGS += --with-macosx-version-min=$(VC_OSX_TARGET) --with-macosx-sdk=$(VC_OSX_SDK)
  250 
  251 	ifeq "$(CPU_ARCH)" "x64"
  252 		CPU_ARCH = x86
  253 	endif
  254 
  255 	CFLAGS += -msse2
  256 	CXXFLAGS += -msse2
  257 
  258 	ifeq "$(origin SSSE3)" "command line"
  259 		CFLAGS += -mssse3
  260 		CXXFLAGS += -mssse3
  261 	endif
  262 
  263 	ifeq "$(origin SSE41)" "command line"
  264 		CFLAGS += -mssse3 -msse4.1
  265 		CXXFLAGS += -mssse3 -msse4.1
  266 	endif
  267 
  268 	AS := $(BASE_DIR)/Build/Tools/MacOSX/yasm
  269 	export ASFLAGS32 := -D __GNUC__ -D __YASM__ -D __BITS__=32 --prefix=_ -f macho32
  270 	export ASFLAGS64 := -D __GNUC__ -D __YASM__ -D __BITS__=64 --prefix=_ -f macho64
  271 
  272 	ifeq "$(TC_BUILD_CONFIG)" "Release"
  273 
  274 		export DISABLE_PRECOMPILED_HEADERS := 1
  275 
  276 		S := $(C_CXX_FLAGS)
  277 		C_CXX_FLAGS = $(subst -MMD,,$(S))
  278 
  279 		C_CXX_FLAGS += -gfull -arch i386 -arch x86_64
  280 		LFLAGS += -Wl,-dead_strip -arch i386 -arch x86_64
  281 
  282 		WX_CONFIGURE_FLAGS += --enable-universal_binary=i386,x86_64
  283 		WXCONFIG_CFLAGS += -gfull
  284 		WXCONFIG_CXXFLAGS += -gfull
  285 
  286 	else
  287 
  288 		WX_CONFIGURE_FLAGS += --disable-universal_binary
  289 
  290 	endif
  291 
  292 endif
  293 
  294 
  295 #------ FreeBSD configuration ------
  296 
  297 ifeq "$(shell uname -s)" "FreeBSD"
  298 
  299 	PLATFORM := FreeBSD
  300 	PLATFORM_UNSUPPORTED := 1
  301 	C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_FREEBSD
  302 	
  303 	CC := cc
  304 	CXX := c++
  305 	
  306 	ifeq "$(TC_BUILD_CONFIG)" "Release"
  307 		C_CXX_FLAGS += -fdata-sections -ffunction-sections -fpie
  308 		LFLAGS += -Wl,--gc-sections -pie
  309 
  310 		ifneq "$(shell ld --help 2>&1 | grep sysv | wc -l)" "0"
  311 			LFLAGS += -Wl,--hash-style=sysv
  312 		endif
  313 
  314 		WXCONFIG_CFLAGS += -fpie -fPIC
  315 		WXCONFIG_CXXFLAGS += -fpie -fPIC
  316 	endif
  317 
  318 	ifeq "$(SIMD_SUPPORTED)" "1"
  319 		CFLAGS += -msse2 -maes
  320 		CXXFLAGS += -msse2 -maes
  321 
  322 		ifeq "$(origin SSSE3)" "command line"
  323 			CFLAGS += -mssse3
  324 			CXXFLAGS += -mssse3
  325 		endif
  326 
  327 		ifeq "$(origin SSE41)" "command line"
  328 			CFLAGS += -mssse3 -msse4.1
  329 			CXXFLAGS += -mssse3 -msse4.1
  330 		endif
  331 	endif
  332 	
  333 	ifeq "$(origin NOSSE2)" "command line"
  334 		CFLAGS += -mno-sse2
  335 		CXXFLAGS += -mno-sse2
  336 		WXCONFIG_CFLAGS += -mno-sse2
  337 		WXCONFIG_CXXFLAGS += -mno-sse2
  338 	endif
  339 
  340 endif
  341 
  342 
  343 #------ Solaris configuration ------
  344 
  345 ifeq "$(shell uname -s)" "SunOS"
  346 
  347 	PLATFORM := Solaris
  348 	PLATFORM_UNSUPPORTED := 1
  349 	C_CXX_FLAGS += -DTC_UNIX -DTC_SOLARIS
  350 	WX_CONFIGURE_FLAGS += --with-gtk
  351 
  352 endif
  353 
  354 
  355 #------ Common configuration ------
  356 
  357 CFLAGS := $(C_CXX_FLAGS) $(CFLAGS) $(TC_EXTRA_CFLAGS)
  358 CXXFLAGS := $(C_CXX_FLAGS) $(CXXFLAGS) $(TC_EXTRA_CXXFLAGS)
  359 LFLAGS := $(LFLAGS) $(TC_EXTRA_LFLAGS)
  360 
  361 WX_CONFIGURE_FLAGS += --enable-unicode -disable-shared --disable-dependency-tracking --disable-compat26 --enable-exceptions --enable-std_string --enable-dataobj --enable-mimetype \
  362 	--disable-protocol --disable-protocols --disable-url --disable-ipc --disable-sockets --disable-fs_inet --disable-ole --disable-docview --disable-clipboard \
  363 	--disable-help --disable-html --disable-mshtmlhelp --disable-htmlhelp --disable-mdi --disable-metafile --disable-webkit --disable-webview \
  364 	--disable-xrc --disable-aui --disable-postscript --disable-printarch \
  365 	--disable-arcstream --disable-fs_archive --disable-fs_zip --disable-tarstream --disable-zipstream \
  366 	--disable-animatectrl --disable-bmpcombobox --disable-calendar --disable-caret --disable-checklst --disable-collpane --disable-colourpicker --disable-comboctrl \
  367 	--disable-datepick --disable-display --disable-dirpicker --disable-filepicker --disable-fontpicker --disable-grid  --disable-dataviewctrl \
  368 	--disable-listbook --disable-odcombobox --disable-sash  --disable-searchctrl --disable-slider --disable-splitter --disable-togglebtn \
  369 	--disable-toolbar --disable-tbarnative --disable-treebook --disable-toolbook --disable-tipwindow --disable-popupwin \
  370 	--disable-commondlg --disable-aboutdlg --disable-coldlg --disable-finddlg --disable-fontdlg --disable-numberdlg --disable-splash \
  371 	--disable-tipdlg --disable-progressdlg --disable-wizarddlg --disable-miniframe --disable-splines --disable-palette \
  372 	--disable-richtext --disable-dialupman --disable-debugreport --disable-filesystem --disable-rearrangectrl --disable-treelist --disable-richmsgdlg \
  373 	--disable-richtooltip --disable-propgrid --disable-stc --without-libnotify \
  374 	--without-gtkprint --without-gnomevfs --disable-fsvolume --disable-fswatcher \
  375 	--disable-graphics_ctx --disable-sound --disable-mediactrl --disable-joystick --disable-apple_ieee \
  376 	--disable-gif --disable-pcx --disable-tga --disable-iff --disable-gif --disable-pnm --disable-svg \
  377 	--without-expat --without-libtiff --without-libjpeg --without-libpng -without-regex --without-zlib
  378 
  379 ifeq "$(PLATFORM)" "Linux"
  380 WX_CONFIGURE_FLAGS += --disable-tooltips
  381 endif
  382 
  383 #------ Project build ------
  384 
  385 PROJ_DIRS := Platform Volume Driver/Fuse Core Main
  386 
  387 .PHONY: all clean wxbuild
  388 
  389 all clean:
  390 	@if pwd | grep -q ' '; then echo 'Error: source code is stored in a path containing spaces' >&2; exit 1; fi
  391 
  392 	@for DIR in $(PROJ_DIRS); do \
  393 		PROJ=$$(echo $$DIR | cut -d/ -f1); \
  394 		$(MAKE) -C $$DIR -f $$PROJ.make NAME=$$PROJ $(MAKECMDGOALS) || exit $?; \
  395 		export LIBS="$(BASE_DIR)/$$DIR/$$PROJ.a $$LIBS"; \
  396 	done
  397 
  398 install:
  399 	$(MAKE) -C Main -f Main.make NAME=Main install
  400 
  401 package:
  402 	$(MAKE) -C Main -f Main.make NAME=Main package
  403 
  404 #------ wxWidgets build ------
  405 
  406 ifeq "$(MAKECMDGOALS)" "wxbuild"
  407 CFLAGS :=
  408 CXXFLAGS :=
  409 LFLAGS :=
  410 endif
  411 
  412 wxbuild:
  413 
  414 ifneq "$(shell test -f $(WX_ROOT)/configure || test -f $(WX_BUILD_DIR)/../configure && echo 1)" "1"
  415 	@echo 'Error: WX_ROOT must point to wxWidgets source code directory' >&2
  416 	@exit 1
  417 endif
  418 
  419 	rm -rf "$(WX_BUILD_DIR)"
  420 	mkdir -p "$(WX_BUILD_DIR)"
  421 	@echo Configuring wxWidgets library...
  422 	cd "$(WX_BUILD_DIR)" && "$(WX_ROOT)/configure" $(WX_CONFIGURE_FLAGS) >/dev/null
  423 
  424 	@echo Building wxWidgets library...
  425 	cd "$(WX_BUILD_DIR)" && $(MAKE)