| 1 |
# Copyright (C) 2006, Adam Cécile (Le_Vert) <[email protected]> |
| 2 |
# (C) 2008, Cedric Tissieres <http://www.objectif-securite.ch> |
| 3 |
# |
| 4 |
# This program is free software; you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU General Public License as published by |
| 6 |
# the Free Software Foundation; either version 2 of the License, or |
| 7 |
# or (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program; if not, write to the Free Software |
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-13, USA |
| 17 |
|
| 18 |
|
| 19 |
# General variables |
| 20 |
PACKAGE = samdump2 |
| 21 |
VERSION = 3.0.0 |
| 22 |
distdir = $(PACKAGE)-$(VERSION) |
| 23 |
DISTFILES = AUTHORS ChangeLog hive.c LICENSE list.h Makefile\ |
| 24 |
samdump2.1 samdump2.h bkhive.c COPYING hive.h list.c\ |
| 25 |
main.c README samdump2.c dumpsam.c ntdll.h |
| 26 |
DESTDIR = |
| 27 |
PREFIX ?= /usr/local/ |
| 28 |
BINDIR = $(PREFIX)/bin |
| 29 |
MANDIR = $(PREFIX)/share/man/man1 |
| 30 |
INSTALL = $(shell which install) |
| 31 |
CC ?= $(shell which gcc) |
| 32 |
CFLAGS += -Wall |
| 33 |
LIBS = -lcrypto |
| 34 |
|
| 35 |
# Default target |
| 36 |
all: build |
| 37 |
|
| 38 |
build: samdump2 |
| 39 |
|
| 40 |
samdump2: hive.o list.o bkhive.o samdump2.o main.o dumpsam.o |
| 41 |
@echo "Building binary..." |
| 42 |
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) $(LDFLAGS) |
| 43 |
@echo "" |
| 44 |
|
| 45 |
# Clean target |
| 46 |
clean: |
| 47 |
@echo "Cleaning sources..." |
| 48 |
rm -f *.o samdump2 *~ |
| 49 |
@echo "" |
| 50 |
|
| 51 |
# Install target |
| 52 |
install: build |
| 53 |
@echo "Creating directories..." |
| 54 |
$(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(BINDIR) |
| 55 |
$(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(MANDIR) |
| 56 |
@echo "Copying binary..." |
| 57 |
$(INSTALL) samdump2 -m 755 -o root -g root $(DESTDIR)$(BINDIR) |
| 58 |
@echo "Installing man page..." |
| 59 |
$(INSTALL) samdump2.1 -m 644 -o root -g root $(DESTDIR)$(MANDIR) |
| 60 |
@echo "" |
| 61 |
|
| 62 |
# Uninstall target |
| 63 |
uninstall: |
| 64 |
@echo "Deleting binary and manpages..." |
| 65 |
rm -f $(DESTDIR)$(BINDIR)/samdump2 |
| 66 |
rm -f $(DESTDIR)$(MANDIR)/samdump2.1 |
| 67 |
@echo "" |
| 68 |
|
| 69 |
dist: clean |
| 70 |
rm -rf $(distdir) |
| 71 |
mkdir $(distdir) |
| 72 |
cp $(DISTFILES) $(distdir) |
| 73 |
tar cfj $(distdir).tar.bz2 $(distdir) |
| 74 |
rm -rf $(distdir) |
| 75 |
|