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 49 50 51 52 53 54 55 56 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
|
CC = gcc
CC_OPTS = -Wall -O2
GOAL = foremost
# These options are used for cross-compiling for Windows via linux.
# If you don't plan on doing this, don't worry about them
CROSSCC = /usr/local/cross-tools/i386-mingw32msvc/bin/gcc
CROSSOPT = -Wall -O2 -D__WIN32
CROSSLINK = -liberty
CROSSGOAL = $(GOAL).exe
# You shouldn't need to change anything below this line
#---------------------------------------------------------------------
# Where foremost gets installed
BIN = /usr/local/bin
MAN = /usr/local/man/man1
# This should be commented out when debugging is done
#CC_OPTS += -D__DEBUG -ggdb
# This is used when generating packages
VERSION = 0.69
# Generic "how to compile C files"
CC += $(CC_OPTS)
.c.o:
$(CC) -c $<
# Definitions we'll need later (and that should almost never change)
HEADER_FILES = foremost.h
SRC = helpers.c files.c foremost.c dig.c
OBJS = helpers.o foremost.o files.o dig.o
all: linux
openbsd: CC+= -D__OPENBSD -D__GLIBC__
openbsd: $(GOAL)
linux: CC += -D__LINUX
linux: $(GOAL)
# This version of foremost will compile under Cygwin or mingw.
# Not all features have been fully tested on windows.
win32: CC += $(CROSSOPT)
win32: $(SRC) $(HEADER_FILES)
$(CC) -o $(CROSSGOAL) $(SRC) $(CROSSLINK)
cross-win: $(CROSSCC) += $(CROSSOPT)
cross-win: $(SRC) $(HEADER_FILES)
$(CROSSCC) -o $(CROSSGOAL) $(SRC) $(CROSSLINK)
$(GOAL): $(OBJS)
$(CC) -o $(GOAL) $(OBJS)
install: all
install -CDm 755 $(GOAL) $(BIN)/$(GOAL)
install -CDm 644 $(GOAL).1 $(MAN)/$(GOAL).1
uninstall:
rm -f $(BIN)/$(GOAL) $(MAN)/$(GOAL).1
rpms:
rpm -ba rpm/foremost-$(VERSION)-1.spec
cp /usr/src/redhat/RPMS/i386/foremost-$(VERSION)-1.i386.rpm rpm
cp /usr/src/redhat/SRPMS/foremost-$(VERSION)-1.src.rpm rpm
chown jessek.jessek rpm/*
foremost.o: foremost.c $(HEADER_FILES)
helpers.o: helpers.c $(HEADER_FILES)
files.o: files.c $(HEADER_FILES)
# This is used for debugging
preflight:
grep -n RBF *.h *.c
nice:
rm -f *~
rm -rf output foremost-output out
clean: nice
rm -f $(OBJS) $(GOAL) $(GOAL).exe core *.core
#-------------------------------------------------------------------------
DEST_DIR = $(GOAL)-$(VERSION)
TAR_FILE = $(DEST_DIR).tar
DOCS = CHANGES TODO README
PKG_FILES = $(SRC) $(HEADER_FILES) foremost.conf foremost.1 Makefile $(DOCS)
# This packages me up to send to somebody else
package:
rm -f $(TAR_FILE) $(TAR_FILE).gz
mkdir $(DEST_DIR)
cp $(PKG_FILES) $(DEST_DIR)
tar cvf $(TAR_FILE) $(DEST_DIR)
rm -rf $(DEST_DIR)
gzip $(TAR_FILE)
publish: package
cp $(TAR_FILE).gz /home/jessek/rnd/Foremost/
|