Debian Codegraph @

Makefile

raw symbols ◀ ▶
Source reconstructed at patch state 1 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 gnu: unix
78 gnu/kfreebsd: unix
79 unix: goals
80
81 #Fore some reasons BSD variants get confused on how to build engine.o
82 #so lets make it real clear
83
84 engine.o: engine.c
85 $(CC) -c engine.c
86
87
88 # Common commands for compiling versions for Windows.
89 # See cross and windows directives below.
90 win_general: LINK_OPT = $(CR_LINK)
91 win_general: GOAL = $(CR_GOAL)
92 win_general: goals
93 $(STRIP) $(CR_GOAL)
94
95 # Cross compiling from Linux to Windows. See README for more info
96 cross: CC = $(CR_CC) $(CR_OPT)
97 cross: STRIP = $(CR_STRIP)
98 cross: win_general
99
100 # See the README for information on Windows compilation
101 windows: CC = $(WINCC)
102 windows: STRIP = strip
103 windows: win_general
104
105 cygwin_nt.: unix
106 cygwin: unix
107
108
109 #---------------------------------------------------------------------
110 # COMPILE THE PROGRAMS
111 # This section must be updated each time you add an algorithm
112 #---------------------------------------------------------------------
113
114 foremost: $(OBJ)
115 $(CC) $(OBJ) -o $(NAME) $(LINK_OPT)
116
117
118 #---------------------------------------------------------------------
119 # INSTALLATION AND REMOVAL
120 #---------------------------------------------------------------------
121
122 install: goals
123 install -m 755 $(NAME) $(BIN)
124 install -m 444 $(MAN_PAGES) $(MAN)
125 install -m 444 foremost.conf $(CONF)
126 macinstall: BIN = /usr/local/bin/
127 macinstall: MAN = /usr/share/man/man1/
128 macinstall: CONF = /usr/local/etc/
129 macinstall: mac install
130
131
132 uninstall:
133 rm -f -- $(BIN)/{$(RM_GOALS)}
134 rm -f -- $(MAN)/{$(RM_DOCS)}
135
136 macuninstall: BIN = /usr/bin
137 macuninstall: MAN = /usr/share/man/man1
138 macuninstall: uninstall
139
140 #---------------------------------------------------------------------
141 # CLEAN UP
142 #---------------------------------------------------------------------
143
144 # This is used for debugging
145 preflight:
146 grep -n RBF *.1 *.h *.c README CHANGES
147
148 nice:
149 rm -f -- *~
150
151 clean: nice
152 rm -f -- *.o
153 rm -f -- $(CR_GOAL) $(NAME) $(WIN_DOC)
154 rm -f -- $(TAR_FILE).gz $(DEST_DIR).zip $(DEST_DIR).zip.gpg
155
156 #-------------------------------------------------------------------------
157 # MAKING PACKAGES
158 #-------------------------------------------------------------------------
159
160 EXTRA_FILES =
161 DEST_DIR = $(NAME)-$(VERSION)
162 TAR_FILE = $(DEST_DIR).tar
163 PKG_FILES = $(SRC) $(HEADER_FILES) $(DOCS) $(EXTRA_FILES)
164
165 # This packages me up to send to somebody else
166 package: clean
167 rm -f $(TAR_FILE) $(TAR_FILE).gz
168 mkdir $(DEST_DIR)
169 cp $(PKG_FILES) $(DEST_DIR)
170 tar cvf $(TAR_FILE) $(DEST_DIR)
171 rm -rf $(DEST_DIR)
172 gzip $(TAR_FILE)
173
174
175 # This Makefile is designed for Mac OSX to package the file.
176 # To do this on a linux box, The big line below starting with "/usr/bin/tbl"
177 # should be replaced with:
178 #
179 # man ./$(MD5GOAL).1 | col -bx > README.txt
180 #
181 # and the "flip -d" command should be replaced with dos2unix
182 #
183 # The flip command can be found at:
184 # http://ccrma-www.stanford.edu/~craig/utility/flip/#
185 win-doc:
186 /usr/bin/tbl ./$(MD5GOAL).1 | /usr/bin/groff -S -Wall -mtty-char -mandoc -Tascii | /usr/bin/col > README.txt
187 cp CHANGES CHANGES.txt
188 flip -d $(WINDOC)
189
190 cross-pkg: clean cross win-doc
191 rm -f $(DEST_DIR).zip
192 zip $(DEST_DIR).zip $(CR_MD5GOAL) $(CR_SHA1GOAL) $(CR_SHA256GOAL) $(WINDOC)
193 rm -f $(WINDOC)
194
195 world: package cross-pkg