1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 07:08:19 +00:00

Building: Add SHARED variable to Makefile to choose if hashcat is build as static or shared binary (using libhashcat.so/hashcat.dll)

This commit is contained in:
jsteube 2017-01-27 09:58:01 +01:00
parent 07c89833c9
commit b7b2f1a79c
2 changed files with 10 additions and 7 deletions

View File

@ -35,7 +35,7 @@
## Technical
##
- Building: Split native compilation into two dedicated targets: "hashcat_static" and "hashcat_shared", default is "hashcat_static"
- Building: Add SHARED variable to Makefile to choose if hashcat is build as static or shared binary (using libhashcat.so/hashcat.dll)
- Building: Removed the use of RPATH on linker level
- Events: Improved the maximum event message handling. event_log () will now also internally make sure that the message is properly terminated

View File

@ -111,6 +111,7 @@ COMPTIME := $(shell date +%s)
VERSION_EXPORT := $Format:%D$
VERSION_TAG := $(shell test -d .git && git describe --tags --dirty=+ || echo "$(VERSION_EXPORT)"|cut -d, -f2|$(SED) -r 's|.* (\w+/)?([^ ]+)|\2|')
SHARED := 0
PRODUCTION := 0
##
@ -289,7 +290,7 @@ WIN_64_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.64.o) $(CRT_
## Targets: Native Compilation
##
default: hashcat_static
default: hashcat
clean:
$(RM) -f obj/*.o obj/lzma_sdk/*.o *.bin *.exe *.so *.dll *.restore *.out *.pot *.log hashcat core
@ -382,11 +383,13 @@ obj/%.NATIVE.SHARED.o: src/%.c
$(HASHCAT_LIBRARY): $(NATIVE_SHARED_OBJS)
$(CC) $^ $(LFLAGS_NATIVE) -o $@ -shared
hashcat_shared: $(HASHCAT_LIBRARY)
$(CC) $(CFLAGS_NATIVE) src/main.c -L. -lhashcat $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" -o $(HASHCAT_FRONTEND)
hashcat_static: $(NATIVE_STATIC_OBJS)
$(CC) $(CFLAGS_NATIVE) src/main.c $^ $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" -o $(HASHCAT_FRONTEND)
ifeq ($(SHARED),1)
$(HASHCAT_FRONTEND): src/main.c $(HASHCAT_LIBRARY)
$(CC) $(CFLAGS_NATIVE) $^ -L. -lhashcat $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" -o $@
else
$(HASHCAT_FRONTEND): src/main.c $(NATIVE_STATIC_OBJS)
$(CC) $(CFLAGS_NATIVE) $^ $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" -o $@
endif
##
## cross compiled hashcat