Debian Codegraph @

Makefile

raw symbols ◀ ▶ SCIP
4 Debian patches touch this file
1
2 RAW_CC = gcc
3 RAW_FLAGS = -Wall -O2
4 LINK_OPT =
5 VERSION = 1.5.7
6 # Try to determine the host system
7 SYS := $(shell uname -s | tr -d "[0-9]" | tr -d "-" | tr "[A-Z]" "[a-z]")
8
9
10 # You can cross compile this program for Win32 using Linux and the
11 # MinGW compiler. See the README for details. If you have already
12 # installed MinGW, put the location ($PREFIX) here:
13 CR_BASE = /usr/local/cross-tools/i386-mingw32msvc/bin
14
15 # You shouldn't need to change anything below this line
16 #---------------------------------------------------------------------
17
18 # This should be commented out when debugging is done
19 #RAW_FLAGS += -D__DEBUG -ggdb
20
21 NAME = foremost
22 MAN_PAGES = $(NAME).8.gz
23
24 RAW_FLAGS += -DVERSION=\"$(VERSION)\"
25
26 # Where we get installed
27 BIN = /usr/local/bin
28 MAN = /usr/share/man/man8
29 CONF= /usr/local/etc
30 # Setup for compiling and cross-compiling for Windows
31 # The CR_ prefix refers to cross compiling from OSX to Windows
32 CR_CC = $(CR_BASE)/gcc
33 CR_OPT = $(RAW_FLAGS) -D__WIN32
34 CR_LINK = -liberty
35 CR_STRIP = $(CR_BASE)/strip
36 CR_GOAL = $(NAME).exe
37 WINCC = $(RAW_CC) $(RAW_FLAGS) -D__WIN32
38
•39 %.o : %.c
40 $(CC) $(CFLAGS) $(CPPFLAGS) $(RAW_FLAGS) -D__UNIX -c $<
41
42
43 # Definitions we'll need later (and that should rarely change)
44 HEADER_FILES = main.h ole.h extract.h
45 SRC = main.c state.c helpers.c config.c cli.c engine.c dir.c extract.c api.c
46 OBJ = main.o state.o helpers.o config.o cli.o engine.o dir.o extract.o api.o
47 DOCS = Makefile README CHANGES $(MAN_PAGES) foremost.conf
48 WINDOC = README.txt CHANGES.txt
49
50
51 #---------------------------------------------------------------------
52 # OPERATING SYSTEM DIRECTIVES
53 #---------------------------------------------------------------------
54
55 all: $(SYS) goals
56
57 goals: $(NAME)
58
59 linux: CC += -D__LINUX -DLARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
60 linux: goals
61
62 sunos: solaris
63 solaris: CC += -D__SOLARIS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
64 solaris: goals
65
66 darwin: CC += -D__MACOSX
67 darwin: goals
68
69 mac: CC += -D__MACOSX
70 mac: goals
71
72 netbsd: unix
73 openbsd: unix
74 freebsd: unix
•75
76 gnu: CC += -DPATH_MAX=4096
77 gnu: unix
•78
79 gnu/kfreebsd: unix
80 unix: goals
81
82 #Fore some reasons BSD variants get confused on how to build engine.o
83 #so lets make it real clear
84
85 engine.o: engine.c
•86 $(CC) $(CFLAGS) $(CPPFLAGS) $(RAW_FLAGS) -c engine.c
87
88
89 # Common commands for compiling versions for Windows.
90 # See cross and windows directives below.
91 win_general: LINK_OPT = $(CR_LINK)
92 win_general: GOAL = $(CR_GOAL)
93 win_general: goals
94 $(STRIP) $(CR_GOAL)
95
96 # Cross compiling from Linux to Windows. See README for more info
97 cross: CC = $(CR_CC) $(CR_OPT)
98 cross: STRIP = $(CR_STRIP)
99 cross: win_general
100
101 # See the README for information on Windows compilation
102 windows: CC = $(WINCC)
103 windows: STRIP = strip
104 windows: win_general
105
106 cygwin_nt.: unix
107 cygwin: unix
108
109
110 #---------------------------------------------------------------------
111 # COMPILE THE PROGRAMS
112 # This section must be updated each time you add an algorithm
113 #---------------------------------------------------------------------
114
115 foremost: $(OBJ)
•116 $(CC) $(OBJ) -o $(NAME) $(LDFLAGS)
117
118
119 #---------------------------------------------------------------------
120 # INSTALLATION AND REMOVAL
121 #---------------------------------------------------------------------
122
123 install: goals
124 install -m 755 $(NAME) $(BIN)
125 install -m 444 $(MAN_PAGES) $(MAN)
126 install -m 444 foremost.conf $(CONF)
127 macinstall: BIN = /usr/local/bin/
128 macinstall: MAN = /usr/share/man/man1/
129 macinstall: CONF = /usr/local/etc/
130 macinstall: mac install
131
132
133 uninstall:
134 rm -f -- $(BIN)/{$(RM_GOALS)}
135 rm -f -- $(MAN)/{$(RM_DOCS)}
136
137 macuninstall: BIN = /usr/bin
138 macuninstall: MAN = /usr/share/man/man1
139 macuninstall: uninstall
140
141 #---------------------------------------------------------------------
142 # CLEAN UP
143 #---------------------------------------------------------------------
144
145 # This is used for debugging
146 preflight:
147 grep -n RBF *.1 *.h *.c README CHANGES
148
149 nice:
150 rm -f -- *~
151
152 clean: nice
153 rm -f -- *.o
154 rm -f -- $(CR_GOAL) $(NAME) $(WIN_DOC)
155 rm -f -- $(TAR_FILE).gz $(DEST_DIR).zip $(DEST_DIR).zip.gpg
156
157 #-------------------------------------------------------------------------
158 # MAKING PACKAGES
159 #-------------------------------------------------------------------------
160
161 EXTRA_FILES =
162 DEST_DIR = $(NAME)-$(VERSION)
163 TAR_FILE = $(DEST_DIR).tar
164 PKG_FILES = $(SRC) $(HEADER_FILES) $(DOCS) $(EXTRA_FILES)
165
166 # This packages me up to send to somebody else
167 package: clean
168 rm -f $(TAR_FILE) $(TAR_FILE).gz
169 mkdir $(DEST_DIR)
170 cp $(PKG_FILES) $(DEST_DIR)
171 tar cvf $(TAR_FILE) $(DEST_DIR)
172 rm -rf $(DEST_DIR)
173 gzip $(TAR_FILE)
174
175
176 # This Makefile is designed for Mac OSX to package the file.
177 # To do this on a linux box, The big line below starting with "/usr/bin/tbl"
178 # should be replaced with:
179 #
180 # man ./$(MD5GOAL).1 | col -bx > README.txt
181 #
182 # and the "flip -d" command should be replaced with dos2unix
183 #
184 # The flip command can be found at:
185 # http://ccrma-www.stanford.edu/~craig/utility/flip/#
186 win-doc:
187 /usr/bin/tbl ./$(MD5GOAL).1 | /usr/bin/groff -S -Wall -mtty-char -mandoc -Tascii | /usr/bin/col > README.txt
188 cp CHANGES CHANGES.txt
189 flip -d $(WINDOC)
190
191 cross-pkg: clean cross win-doc
192 rm -f $(DEST_DIR).zip
193 zip $(DEST_DIR).zip $(CR_MD5GOAL) $(CR_SHA1GOAL) $(CR_SHA256GOAL) $(WINDOC)
194 rm -f $(WINDOC)
195
196 world: package cross-pkg