Makefile.in 3.65 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
# Extract the version string from ncrack.h.
export NCRACK_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NCRACK_VERSION' \
	ncrack.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q')
NCRACK_NAME= Ncrack
NCRACK_URL= http://ncrack.org
NCRACK_PLATFORM=@host@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
mandir = @mandir@
srcdir = @srcdir@
ncrackdatadir = @datadir@/ncrack

export NBASEDIR = @NBASEDIR@
export NSOCKDIR = @NSOCKDIR@
export OPENSSHLIB_DIR = @OPENSSHLIB_DIR@

DEFS = @DEFS@ -DNCRACK_NAME=\"$(NCRACK_NAME)\" -DNCRACK_URL=\"$(NCRACK_URL)\" \
-DNCRACK_PLATFORM=\"$(NCRACK_PLATFORM)\" -DNCRACKDATADIR=\"$(ncrackdatadir)\"
DEFS += -D_FORTIFY_SOURCE=2 

CC = @CC@
CXX = @CXX@
CCOPT = 
DBGFLAGS = 
STRIP = @STRIP@
CXXFLAGS = @CXXFLAGS@ $(DBGFLAGS)
CPPFLAGS = @CPPFLAGS@ $(DEFS)
export CFLAGS = $(CXXFLAGS)
STATIC =
LDFLAGS = @LDFLAGS@ $(DBGFLAGS) $(STATIC)
INSTALL = @INSTALL@

MOD_OBJS = @MODULES_OBJS@
MOD_OBJS := $(addprefix modules/,$(MOD_OBJS))
MOD_SRCS = @MODULES_SRCS@
MOD_SRCS := $(addprefix modules/,$(MOD_SRCS))

LIBS = @LIBNSOCK_LIBS@ @LIBNBASE_LIBS@ @OPENSSL_LIBS@ @OPENSSH_LIB@ 

DESTDIR =

TARGET = ncrack

export SRCS = ncrack.cc utils.cc TargetGroup.cc Target.cc targets.cc \
NcrackOps.cc Service.cc ServiceGroup.cc Connection.h services.cc \
timing.cc ncrack_error.cc output.cc ncrack_tty.cc Buf.cc \
49 50
NcrackOutputTable.cc ncrack_input.cc ncrack_resume.cc crypto.cc http.cc \
http_digest.cc 
51 52 53 54

OBJS = ncrack.o utils.o TargetGroup.o Target.o targets.o NcrackOps.o \
Service.o ServiceGroup.o Connection.o services.o timing.o \
ncrack_error.o output.o ncrack_tty.o Buf.o NcrackOutputTable.o \
55 56
ncrack_input.o ncrack_resume.o crypto.o http.o http_digest.o

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135

.cc.o :
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@

all: @NBASE_BUILD@ @NSOCK_BUILD@ @OPENSSHLIB_BUILD@ @MODULES_BUILD@
	$(MAKE) $(TARGET)

$(TARGET): $(NSOCKDIR)/src/libnsock.a $(NBASEDIR)/libnbase.a $(OBJS) $(MOD_OBJS)
	@echo Compiling Ncrack... 
	rm -f $@
	$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(MOD_OBJS) $(LIBS)
	@echo Ncrack compiled successfully!


modules_build:
	@echo Compiling modules
	cd modules && $(MAKE)

nbase_build: $(NBASEDIR)/Makefile
	@echo Compiling libnbase;
	cd $(NBASEDIR) && $(MAKE)

nsock_build: $(NSOCKDIR)/src/Makefile nbase_build
	@echo Compiling libnsock;
	cd $(NSOCKDIR)/src && $(MAKE)

opensshlib_build: $(OPENSSHLIB_DIR)/Makefile
	@echo Compiling openssh lib;
	cd $(OPENSSHLIB_DIR) && $(MAKE)



install: install-ncrack
	@echo "NCRACK SUCCESSFULLY INSTALLED"

install-ncrack: $(TARGET)
	$(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(ncrackdatadir)
	$(INSTALL) -c -m 755 ncrack $(DESTDIR)$(bindir)/ncrack
	$(STRIP) $(DESTDIR)$(bindir)/ncrack
	$(INSTALL) -c -m 644 docs/$(TARGET).1 $(DESTDIR)$(mandir)/man1/
#	$(INSTALL) -c -m 644 docs/ncrack.xsl $(DESTDIR)$(ncrackdatadir)/
#	$(INSTALL) -c -m 644 docs/ncrack.dtd $(DESTDIR)$(ncrackatadir)/
	$(INSTALL) -c -m 644 ncrack-services $(DESTDIR)$(ncrackdatadir)/
	$(INSTALL) -c -m 644 lists/* $(DESTDIR)$(ncrackdatadir)/


uninstall: uninstall-ncrack

uninstall-ncrack:
	rm -f $(DESTDIR)$(bindir)/$(TARGET)
	rm -f $(DESTDIR)$(mandir)/man1/$(TARGET).1
	rm -rf $(DESTDIR)$(ncrackdatadir)


# cleaning stuff

clean: nsock_clean nbase_clean opensshlib_clean modules_clean my_clean 

my_clean:
	rm -f dependencies.mk makefile.dep
	rm -f $(OBJS) $(TARGET) config.cache
nbase_clean:
	-cd $(NBASEDIR) && $(MAKE) clean
nsock_clean:
	-cd $(NSOCKDIR)/src && $(MAKE) clean
opensshlib_clean:
	-cd $(OPENSSHLIB_DIR) && $(MAKE) clean
modules_clean:
	-cd modules && $(MAKE) clean

Makefile: Makefile.in config.status
	./config.status

config.status: configure
	./config.status --recheck

makefile.dep:
	$(CXX) -MM $(CPPFLAGS) $(SRCS) > $@
include makefile.dep