Debian Codegraph @

Makefile

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 4 — not the installed (fully patched) source.
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 # Generic "how to compile C files"
40 CC = $(RAW_CC) $(RAW_FLAGS) -D__UNIX
41 .c.o:
42 $(CC) -c $<
43
44
45 # Definitions we'll need later (and that should rarely change)
46 HEADER_FILES = main.h ole.h extract.h
47 SRC = main.c state.c helpers.c config.c cli.c engine.c dir.c extract.c api.c
48 OBJ = main.o state.o helpers.o config.o cli.o engine.o dir.o extract.o api.o
49 DOCS = Makefile README CHANGES $(MAN_PAGES) foremost.conf
50 WINDOC = README.txt CHANGES.txt
51
52
53 #---------------------------------------------------------------------
54 # OPERATING SYSTEM DIRECTIVES
55 #---------------------------------------------------------------------
56
57 all: $(SYS) goals
58
59 goals: $(NAME)
60
61 linux: CC += -D__LINUX -DLARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
62 linux: goals
63
64 sunos: solaris
65 solaris: CC += -D__SOLARIS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
66 solaris: goals
67
68 darwin: CC += -D__MACOSX
69 darwin: goals
70
71 mac: CC += -D__MACOSX
72 mac: goals
73
74 netbsd: unix
75 openbsd: unix
76 freebsd: unix
77 unix: goals
78
79 #Fore some reasons BSD variants get confused on how to build engine.o
80 #so lets make it real clear
81
82 engine.o: engine.c
83 $(CC) -c engine.c
84
85
86 # Common commands for compiling versions for Windows.
87 # See cross and windows directives below.
88 win_general: LINK_OPT = $(CR_LINK)
89 win_general: GOAL = $(CR_GOAL)
90 win_general: goals
91 $(STRIP) $(CR_GOAL)
92
93 # Cross compiling from Linux to Windows. See README for more info
94 cross: CC = $(CR_CC) $(CR_OPT)
95 cross: STRIP = $(CR_STRIP)
96 cross: win_general
97
98 # See the README for information on Windows compilation
99 windows: CC = $(WINCC)
100 windows: STRIP = strip
101 windows: win_general
102
103 cygwin_nt.: unix
104 cygwin: unix
105
106
107 #---------------------------------------------------------------------
108 # COMPILE THE PROGRAMS
109 # This section must be updated each time you add an algorithm
110 #---------------------------------------------------------------------
111
112 foremost: $(OBJ)
113 $(CC) $(OBJ) -o $(NAME) $(LINK_OPT)
114
115
116 #---------------------------------------------------------------------
117 # INSTALLATION AND REMOVAL
118 #---------------------------------------------------------------------
119
120 install: goals
121 install -m 755 $(NAME) $(BIN)
122 install -m 444 $(MAN_PAGES) $(MAN)
123 install -m 444 foremost.conf $(CONF)
124 macinstall: BIN = /usr/local/bin/
125 macinstall: MAN = /usr/share/man/man1/
126 macinstall: CONF = /usr/local/etc/
127 macinstall: mac install
128
129
130 uninstall:
131 rm -f -- $(BIN)/{$(RM_GOALS)}
132 rm -f -- $(MAN)/{$(RM_DOCS)}
133
134 macuninstall: BIN = /usr/bin
135 macuninstall: MAN = /usr/share/man/man1
136 macuninstall: uninstall
137
138 #---------------------------------------------------------------------
139 # CLEAN UP
140 #---------------------------------------------------------------------
141
142 # This is used for debugging
143 preflight:
144 grep -n RBF *.1 *.h *.c README CHANGES
145
146 nice:
147 rm -f -- *~
148
149 clean: nice
150 rm -f -- *.o
151 rm -f -- $(CR_GOAL) $(NAME) $(WIN_DOC)
152 rm -f -- $(TAR_FILE).gz $(DEST_DIR).zip $(DEST_DIR).zip.gpg
153
154 #-------------------------------------------------------------------------
155 # MAKING PACKAGES
156 #-------------------------------------------------------------------------
157
158 EXTRA_FILES =
159 DEST_DIR = $(NAME)-$(VERSION)
160 TAR_FILE = $(DEST_DIR).tar
161 PKG_FILES = $(SRC) $(HEADER_FILES) $(DOCS) $(EXTRA_FILES)
162
163 # This packages me up to send to somebody else
164 package: clean
165 rm -f $(TAR_FILE) $(TAR_FILE).gz
166 mkdir $(DEST_DIR)
167 cp $(PKG_FILES) $(DEST_DIR)
168 tar cvf $(TAR_FILE) $(DEST_DIR)
169 rm -rf $(DEST_DIR)
170 gzip $(TAR_FILE)
171
172
173 # This Makefile is designed for Mac OSX to package the file.
174 # To do this on a linux box, The big line below starting with "/usr/bin/tbl"
175 # should be replaced with:
176 #
177 # man ./$(MD5GOAL).1 | col -bx > README.txt
178 #
179 # and the "flip -d" command should be replaced with dos2unix
180 #
181 # The flip command can be found at:
182 # http://ccrma-www.stanford.edu/~craig/utility/flip/#
183 win-doc:
184 /usr/bin/tbl ./$(MD5GOAL).1 | /usr/bin/groff -S -Wall -mtty-char -mandoc -Tascii | /usr/bin/col > README.txt
185 cp CHANGES CHANGES.txt
186 flip -d $(WINDOC)
187
188 cross-pkg: clean cross win-doc
189 rm -f $(DEST_DIR).zip
190 zip $(DEST_DIR).zip $(CR_MD5GOAL) $(CR_SHA1GOAL) $(CR_SHA256GOAL) $(WINDOC)
191 rm -f $(WINDOC)
192
193 world: package cross-pkg