1#
2# Disktest Makefile
3# Copyright (c) International Business Machines Corp., 2001
4#
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19#
20#  Please send e-mail to yardleyb@us.ibm.com if you have
21#  questions or comments.
22#
23#  Project Website:  TBD
24#
25#
26# $Id: Makefile.linux,v 1.4 2008/02/14 08:22:22 subrata_modak Exp $
27# $Log: Makefile.linux,v $
28# Revision 1.4  2008/02/14 08:22:22  subrata_modak
29# Disktest application update to version 1.4.2, by, Brent Yardley <yardleyb@us.ibm.com>
30#
31# Revision 1.31  2008/02/07 15:43:37  yardleyb
32# Applied patch from Mike Frysinger to ensure Makefile properly respect CFLAGS/LDFLAGS
33#
34# Revision 1.30  2006/10/19 20:01:48  yardleyb
35# changes made to support rpm builds
36#
37# Revision 1.29  2006/10/19 17:30:27  yardleyb
38# Added basic signal handling.
39#
40# Revision 1.28  2006/05/12 19:44:47  yardleyb
41# added CHANGELOG to distro
42# uninstall does not force a build
43#
44# Revision 1.27  2005/10/12 23:13:35  yardleyb
45# Updates to code to support new function in disktest version 1.3.x.
46# Actual changes are recorded in the README
47#
48# Revision 1.26  2004/12/18 06:13:03  yardleyb
49# Updated timer schema to more accurately use the time options.  Added
50# fsync on write option to -If.
51#
52# Revision 1.25  2004/12/17 06:34:56  yardleyb
53# removed -mf -ml.  These mark options cause to may issues when using
54# random block size transfers.  Fixed -ma option for endian-ness.  Fixed
55# false data misscompare during multiple cycles.
56#
57# Revision 1.24  2004/11/20 04:43:42  yardleyb
58# Minor code fixes.  Checking for alloc errors.
59#
60# Revision 1.23  2004/11/19 21:45:12  yardleyb
61# Fixed issue with code added for -F option.  Cased disktest
62# to SEG FAULT when cleaning up threads.
63#
64# Revision 1.22  2004/11/19 03:47:45  yardleyb
65# Fixed issue were args data was not being copied from a
66# clean source.
67#
68# Revision 1.21  2004/11/02 20:47:13  yardleyb
69# Added -F functions.
70# lots of minor fixes. see README
71#
72# Revision 1.20  2003/09/12 21:23:56  yardleyb
73# Updated version to 1.12
74#
75# Revision 1.19  2003/01/13 21:33:31  yardleyb
76# Added code to detect AIX volume size.
77# Updated mask for random LBA to use start_lba offset
78# Updated version to 1.1.10
79#
80# Revision 1.18  2002/05/31 18:48:50  yardleyb
81# Updated version to 1.1.9
82#
83# Revision 1.17  2002/04/24 01:59:45  yardleyb
84# Update to version v1.1.3
85#
86# Revision 1.16  2002/04/02 00:11:04  yardleyb
87# Corrected -D for each OS type
88#
89# Revision 1.15  2002/04/01 20:05:26  yardleyb
90# Modified Makefiles for linux,
91# Created Makefiles for windows/aix
92#
93# Revision 1.14  2002/03/07 03:38:52  yardleyb
94# Added dump function from command
95# line.  Created formatted dump output
96# for Data miscomare and command line.
97# Can now leave off filespec the full
98# path header as it will be added based
99# on -I.
100#
101# Revision 1.13  2002/02/28 04:25:45  yardleyb
102# reworked threading code
103# made locking code a macro.
104#
105# Revision 1.12  2002/02/26 19:35:59  yardleyb
106# Updates to parsing routines for user
107# input.  Added multipliers for -S and
108# -s command line arguments. Forced
109# default seeks to default if performing
110# a diskcache test.
111#
112# Revision 1.11  2002/02/21 21:42:15  yardleyb
113# Updated distro for man1
114#
115# Revision 1.10  2002/02/21 21:34:16  yardleyb
116# Cleaned up make dependancies
117# added install and uninstall
118#
119# Revision 1.9  2002/02/21 01:00:50  yardleyb
120# Added README and directory
121# structure to distro
122#
123# Revision 1.8  2002/02/19 02:46:37  yardleyb
124# Added changes to compile for AIX.
125# Update getvsiz so it returns a -1
126# if the ioctl fails and we handle
127# that fact correctly.  Added check
128# to force vsiz to always be greater
129# then stop_lba.
130#
131# Revision 1.7  2001/12/04 19:00:33  yardleyb
132# Updated to add new files and
133# filename changes
134#
135# Revision 1.6  2001/10/10 00:17:14  yardleyb
136# Added Copyright and GPL license text.
137# Miner bug fixes throughout text.
138#
139# Revision 1.5  2001/09/22 03:29:51  yardleyb
140# Added dependence on main.o for sfunc.h usage.h header files
141#
142# Revision 1.4  2001/09/10 22:14:27  yardleyb
143# Added clean up for tar file. Included man page in distro
144#
145# Revision 1.3  2001/09/06 18:23:30  yardleyb
146# Added duty cycle -D.  Updated usage. Added
147# make option to create .tar.gz of all files
148#
149# Revision 1.2  2001/09/05 22:44:42  yardleyb
150# Split out some of the special functions.
151# added O_DIRECT -Id.  Updated usage.  Lots
152# of clean up to functions.  Added header info
153# to pMsg.
154#
155# Revision 1.1  2001/09/04 19:28:07  yardleyb
156# Split usage out. Split header out.  Added usage text.
157# Made signal handler one function. code cleanup.
158#
159
160# -D "_LARGE_FILES" is used in AIX to support 64bit functions and data types
161# -D"_LARGEFILE64_SOURCE" -D"_FILE_OFFSET_BITS=64" is used in Linux to support 64bit functions and data types. -D"_GNU_SOURCE" is to support Linux O_DIRECT
162# These are typically taken from rpm, but, if not, defined here.
163bindir=/usr/bin
164libdir=/usr/lib
165sysconfdir=/etc
166mandir=/usr/share/man
167
168VER=`grep VER_STR main.h | awk -F\" '{print $$2}'`
169GBLHDRS=main.h globals.h defs.h
170ALLHDRS=$(wildcard *.h)
171SRCS=$(wildcard *.c)
172OBJS=$(SRCS:.c=.o)
173
174CFLAGS += -g -Wall -O -D"LINUX" -D"_THREAD_SAFE" -D"_GNU_SOURCE" -D"_LARGE_FILES" -D"_LARGEFILE64_SOURCE" -D"_FILE_OFFSET_BITS=64" $(RPM_OPT_FLAGS)
175
176all: $(OBJS) disktest
177
178disktest: $(OBJS) $(SRCS) $(ALLHDRS)
179	$(CC) $(CFLAGS) -o disktest $(OBJS) $(LDFLAGS) -lpthread
180
181main.o: main.c $(ALLHDRS)
182sfunc.o: sfunc.c sfunc.h $(GBLHDRS)
183parse.o: parse.c parse.h sfunc.h $(GBLHDRS)
184childmain.o: childmain.c childmain.h sfunc.h parse.h threading.h $(GBLHDRS)
185threading.o: threading.c threading.h childmain.h sfunc.h $(GBLHDRS)
186globals.o: globals.c threading.h $(GBLHDRS)
187usage.o: usage.c usage.h
188Getopt.o: Getopt.c Getopt.h
189io.o: io.c io.h $(GBLHDRS)
190dump.o: dump.c dump.h $(GBLHDRS)
191timer.o: timer.c timer.h $(GBLHDRS)
192stats.o: stats.c stats.h $(GBLHDRS)
193signals.o: signals.c signals.h threading.h $(GBLHDRS)
194
195install: disktest
196	ln -f disktest ../../../bin
197
198clean:
199	rm -f disktest $(OBJS)
200
201all-clean: clean
202	rm -f *~ *tar* *zip*
203
204distro: all-clean
205	mkdir -p disktest-$(VER)/man1
206	cp ./Makefile* ./*.[ch] ./LICENSE ./README ./CHANGELOG disktest-$(VER)
207	cp ./man1/disktest.1 disktest-$(VER)/man1
208	chmod 444 disktest-$(VER)/man1/disktest.1
209	gzip disktest-$(VER)/man1/disktest.1
210	tar cvf ./disktest-$(VER).tar disktest-$(VER)
211	rm -rf disktest-$(VER)
212	gzip ./disktest-$(VER).tar
213