1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 18:08:20 +00:00

Testcommit using ar tool in Makefile

This commit is contained in:
jsteube 2019-04-03 15:37:29 +02:00
parent eb39e64e19
commit 5951322f72

View File

@ -55,6 +55,7 @@ MODULE_INTERFACE_VERSION := 520
## ##
CC := gcc CC := gcc
AR := ar
FIND := find FIND := find
INSTALL := install INSTALL := install
RM := rm RM := rm
@ -222,7 +223,9 @@ endif
ifeq ($(UNAME),Linux) ifeq ($(UNAME),Linux)
CFLAGS_NATIVE := $(CFLAGS) CFLAGS_NATIVE := $(CFLAGS)
CFLAGS_NATIVE += -DWITH_HWMON CFLAGS_NATIVE += -DWITH_HWMON
CFLAGS_NATIVE += -ffunction-sections -fdata-sections
LFLAGS_NATIVE := $(LFLAGS) LFLAGS_NATIVE := $(LFLAGS)
LFLAGS_NATIVE += -Wl,--gc-sections
LFLAGS_NATIVE += -lpthread LFLAGS_NATIVE += -lpthread
LFLAGS_NATIVE += -ldl LFLAGS_NATIVE += -ldl
LFLAGS_NATIVE += -lrt LFLAGS_NATIVE += -lrt
@ -278,7 +281,7 @@ endif # MSYS2
## ##
EMU_OBJS_ALL := emu_general emu_inc_common emu_inc_scalar emu_inc_simd EMU_OBJS_ALL := emu_general emu_inc_common emu_inc_scalar emu_inc_simd
EMU_OBJS_ALL += emu_inc_rp emu_inc_rp_optimized EMU_OBJS_ALL += emu_inc_rp emu_inc_rp_optimized
EMU_OBJS_ALL += emu_inc_truecrypt_crc32 emu_inc_truecrypt_keyfile emu_inc_truecrypt_xts emu_inc_veracrypt_xts EMU_OBJS_ALL += emu_inc_truecrypt_crc32 emu_inc_truecrypt_keyfile emu_inc_truecrypt_xts emu_inc_veracrypt_xts
EMU_OBJS_ALL += emu_inc_hash_md4 emu_inc_hash_md5 emu_inc_hash_ripemd160 emu_inc_hash_sha1 emu_inc_hash_sha256 emu_inc_hash_sha384 emu_inc_hash_sha512 emu_inc_hash_streebog256 emu_inc_hash_streebog512 EMU_OBJS_ALL += emu_inc_hash_md4 emu_inc_hash_md5 emu_inc_hash_ripemd160 emu_inc_hash_sha1 emu_inc_hash_sha256 emu_inc_hash_sha384 emu_inc_hash_sha512 emu_inc_hash_streebog256 emu_inc_hash_streebog512
EMU_OBJS_ALL += emu_inc_cipher_aes emu_inc_cipher_camellia emu_inc_cipher_des emu_inc_cipher_kuznyechik emu_inc_cipher_serpent emu_inc_cipher_twofish EMU_OBJS_ALL += emu_inc_cipher_aes emu_inc_cipher_camellia emu_inc_cipher_des emu_inc_cipher_kuznyechik emu_inc_cipher_serpent emu_inc_cipher_twofish
@ -289,18 +292,14 @@ ifeq ($(ENABLE_BRAIN),1)
OBJS_ALL += brain OBJS_ALL += brain
endif endif
NATIVE_STATIC_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.STATIC.o) NATIVE_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.o)
NATIVE_SHARED_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.SHARED.o)
LINUX_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.o) LINUX_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.o)
WIN_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.o) WIN_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.o)
ifeq ($(USE_SYSTEM_LZMA),0) ifeq ($(USE_SYSTEM_LZMA),0)
OBJS_LZMA := Alloc Lzma2Dec LzmaDec OBJS_LZMA := Alloc Lzma2Dec LzmaDec
NATIVE_STATIC_OBJS += $(foreach OBJ,$(OBJS_LZMA),obj/$(OBJ).NATIVE.STATIC.o) NATIVE_OBJS += $(foreach OBJ,$(OBJS_LZMA),obj/$(OBJ).NATIVE.o)
NATIVE_SHARED_OBJS += $(foreach OBJ,$(OBJS_LZMA),obj/$(OBJ).NATIVE.SHARED.o)
LINUX_OBJS += $(foreach OBJ,$(OBJS_LZMA),obj/$(OBJ).LINUX.o) LINUX_OBJS += $(foreach OBJ,$(OBJS_LZMA),obj/$(OBJ).LINUX.o)
WIN_OBJS += $(foreach OBJ,$(OBJS_LZMA),obj/$(OBJ).WIN.o) WIN_OBJS += $(foreach OBJ,$(OBJS_LZMA),obj/$(OBJ).WIN.o)
endif endif
@ -309,28 +308,12 @@ ifeq ($(USE_SYSTEM_XXHASH),0)
ifeq ($(ENABLE_BRAIN),1) ifeq ($(ENABLE_BRAIN),1)
OBJS_XXHASH := xxhash OBJS_XXHASH := xxhash
NATIVE_STATIC_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).NATIVE.STATIC.o) NATIVE_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).NATIVE.o)
NATIVE_SHARED_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).NATIVE.SHARED.o)
LINUX_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).LINUX.o) LINUX_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).LINUX.o)
WIN_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).WIN.o) WIN_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).WIN.o)
endif endif
endif endif
EMU_MODULE_OBJS_ALL := emu_general emu_inc_common emu_inc_cipher_aes emu_inc_cipher_des emu_inc_hash_md4 emu_inc_hash_md5 emu_inc_hash_sha1 emu_inc_hash_sha256 emu_inc_hash_sha512
MODULE_OBJS_ALL := bitops convert cpu_crc32 ext_lzma filehandling keyboard_layout memory shared $(EMU_MODULE_OBJS_ALL)
ifeq ($(USE_SYSTEM_LZMA),0)
MODULE_OBJS_ALL += Alloc Lzma2Dec LzmaDec
endif
MODULE_NATIVE_STATIC_OBJS := $(foreach OBJ,$(MODULE_OBJS_ALL),obj/$(OBJ).NATIVE.STATIC.o)
MODULE_NATIVE_SHARED_OBJS := $(foreach OBJ,$(MODULE_OBJS_ALL),obj/$(OBJ).NATIVE.SHARED.o)
MODULE_LINUX_OBJS := $(foreach OBJ,$(MODULE_OBJS_ALL),obj/$(OBJ).LINUX.o)
MODULE_WIN_OBJS := $(foreach OBJ,$(MODULE_OBJS_ALL),obj/$(OBJ).WIN.o)
## ##
## Targets: Native Compilation ## Targets: Native Compilation
## ##
@ -461,35 +444,29 @@ uninstall:
## native compiled hashcat library and frontend ## native compiled hashcat library and frontend
## ##
obj/%.NATIVE.STATIC.o: src/%.c obj/%.NATIVE.o: src/%.c
$(CC) -c $(CFLAGS_NATIVE) $< -o $@
obj/%.NATIVE.SHARED.o: src/%.c
$(CC) -c $(CFLAGS_NATIVE) $< -o $@ -fpic $(CC) -c $(CFLAGS_NATIVE) $< -o $@ -fpic
ifeq ($(USE_SYSTEM_LZMA),0) ifeq ($(USE_SYSTEM_LZMA),0)
obj/%.NATIVE.STATIC.o: $(DEPS_LZMA_PATH)/%.c obj/%.NATIVE.o: $(DEPS_LZMA_PATH)/%.c
$(CC) -c $(CFLAGS_NATIVE) $< -o $@
obj/%.NATIVE.SHARED.o: $(DEPS_LZMA_PATH)/%.c
$(CC) -c $(CFLAGS_NATIVE) $< -o $@ -fpic $(CC) -c $(CFLAGS_NATIVE) $< -o $@ -fpic
endif endif
ifeq ($(USE_SYSTEM_XXHASH),0) ifeq ($(USE_SYSTEM_XXHASH),0)
ifeq ($(ENABLE_BRAIN),1) ifeq ($(ENABLE_BRAIN),1)
obj/%.NATIVE.STATIC.o: $(DEPS_XXHASH_PATH)/%.c obj/%.NATIVE.o: $(DEPS_XXHASH_PATH)/%.c
$(CC) -c $(CFLAGS_NATIVE) $< -o $@
obj/%.NATIVE.SHARED.o: $(DEPS_XXHASH_PATH)/%.c
$(CC) -c $(CFLAGS_NATIVE) $< -o $@ -fpic $(CC) -c $(CFLAGS_NATIVE) $< -o $@ -fpic
endif endif
endif endif
obj/combined.NATIVE.a: $(NATIVE_OBJS)
$(AR) rcs $@ $^
ifeq ($(UNAME),Darwin) ifeq ($(UNAME),Darwin)
$(HASHCAT_LIBRARY): $(NATIVE_SHARED_OBJS) $(HASHCAT_LIBRARY): $(NATIVE_OBJS)
$(CC) $^ -o $@ $(LFLAGS_NATIVE) -shared -install_name $(DESTDIR)$(LIBRARY_FOLDER)/$(HASHCAT_LIBRARY) -current_version $(VERSION_PURE) -compatibility_version $(VERSION_PURE) $(CC) $^ -o $@ $(LFLAGS_NATIVE) -shared -install_name $(DESTDIR)$(LIBRARY_FOLDER)/$(HASHCAT_LIBRARY) -current_version $(VERSION_PURE) -compatibility_version $(VERSION_PURE)
else else
$(HASHCAT_LIBRARY): $(NATIVE_SHARED_OBJS) $(HASHCAT_LIBRARY): $(NATIVE_OBJS)
$(CC) $^ -o $@ $(LFLAGS_NATIVE) -shared -Wl,-soname,$(HASHCAT_LIBRARY) $(CC) $^ -o $@ $(LFLAGS_NATIVE) -shared -Wl,-soname,$(HASHCAT_LIBRARY)
endif endif
@ -497,7 +474,7 @@ ifeq ($(SHARED),1)
$(HASHCAT_FRONTEND): src/main.c $(HASHCAT_LIBRARY) $(HASHCAT_FRONTEND): src/main.c $(HASHCAT_LIBRARY)
$(CC) $(CFLAGS_NATIVE) $^ -o $@ $(HASHCAT_LIBRARY) $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" $(CC) $(CFLAGS_NATIVE) $^ -o $@ $(HASHCAT_LIBRARY) $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
else else
$(HASHCAT_FRONTEND): src/main.c $(NATIVE_STATIC_OBJS) $(HASHCAT_FRONTEND): src/main.c obj/combined.NATIVE.a
$(CC) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" $(CC) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
endif endif
@ -518,8 +495,13 @@ endif
MODULES_SRC := $(wildcard src/modules/*.c) MODULES_SRC := $(wildcard src/modules/*.c)
MODULES_LIB := $(patsubst src/modules/module_%.c, modules/module_%.$(MODULE_SUFFIX), $(MODULES_SRC)) MODULES_LIB := $(patsubst src/modules/module_%.c, modules/module_%.$(MODULE_SUFFIX), $(MODULES_SRC))
modules/module_%.$(MODULE_SUFFIX): src/modules/module_%.c $(MODULE_NATIVE_SHARED_OBJS) ifeq ($(SHARED),1)
modules/module_%.$(MODULE_SUFFIX): src/modules/module_%.c $(HASHCAT_LIBRARY)
$(CC) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION) $(CC) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION)
else
modules/module_%.$(MODULE_SUFFIX): src/modules/module_%.c obj/combined.NATIVE.a
$(CC) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION)
endif
modules: $(MODULES_LIB) modules: $(MODULES_LIB)
@ -536,6 +518,9 @@ ifeq ($(UNAME),Linux)
CC_LINUX := gcc CC_LINUX := gcc
CC_WIN := x86_64-w64-mingw32-gcc CC_WIN := x86_64-w64-mingw32-gcc
AR_LINUX := ar
AR_WIN := x86_64-w64-mingw32-ar
## To compile win-iconv with mingw clone from here: https://github.com/win-iconv/win-iconv ## To compile win-iconv with mingw clone from here: https://github.com/win-iconv/win-iconv
## ##
## Then patch the makefile with the patches from tools/win-iconv-64.diff and run make install ## Then patch the makefile with the patches from tools/win-iconv-64.diff and run make install
@ -587,10 +572,10 @@ MODULES_LIB_WIN := $(patsubst src/modules/module_%.c, modules/module_%.dll,
modules_linux: $(MODULES_LIB_LINUX) modules_linux: $(MODULES_LIB_LINUX)
modules_win: $(MODULES_LIB_WIN) modules_win: $(MODULES_LIB_WIN)
modules/module_%.so: src/modules/module_%.c $(MODULE_LINUX_OBJS) modules/module_%.so: src/modules/module_%.c obj/combined.LINUX.a
$(CC_LINUX) $(CFLAGS_CROSS_LINUX) $^ -o $@ $(LFLAGS_CROSS_LINUX) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION) $(CC_LINUX) $(CFLAGS_CROSS_LINUX) $^ -o $@ $(LFLAGS_CROSS_LINUX) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION)
modules/module_%.dll: src/modules/module_%.c $(MODULE_WIN_OBJS) modules/module_%.dll: src/modules/module_%.c obj/combined.WIN.a
$(CC_WIN) $(CFLAGS_CROSS_WIN) $^ -o $@ $(LFLAGS_CROSS_WIN) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION) $(CC_WIN) $(CFLAGS_CROSS_WIN) $^ -o $@ $(LFLAGS_CROSS_WIN) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION)
## ##
@ -621,13 +606,19 @@ obj/%.WIN.o: $(DEPS_XXHASH_PATH)/%.c
endif endif
endif endif
hashcat.bin: src/main.c $(LINUX_OBJS) obj/combined.LINUX.a: $(LINUX_OBJS)
$(AR_LINUX) rcs $@ $^
obj/combined.WIN.a: $(WIN_OBJS)
$(AR_WIN) rcs $@ $^
hashcat.bin: src/main.c obj/combined.LINUX.a
$(CC_LINUX) $(CFLAGS_CROSS_LINUX) -o $@ $^ $(LFLAGS_CROSS_LINUX) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" $(CC_LINUX) $(CFLAGS_CROSS_LINUX) -o $@ $^ $(LFLAGS_CROSS_LINUX) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
hashcat.exe: src/main.c $(WIN_OBJS) $(WIN_ICONV)/lib/libiconv.a hashcat.exe: src/main.c obj/combined.WIN.a $(WIN_ICONV)/lib/libiconv.a
$(CC_WIN) $(CFLAGS_CROSS_WIN) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" $(CC_WIN) $(CFLAGS_CROSS_WIN) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
hashcat.dll: src/main.c $(WIN_OBJS) $(WIN_ICONV)/lib/libiconv.a hashcat.dll: src/main.c obj/combined.WIN.a $(WIN_ICONV)/lib/libiconv.a
$(CC_WIN) $(CFLAGS_CROSS_WIN) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -shared $(CC_WIN) $(CFLAGS_CROSS_WIN) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -shared
endif endif