From c1d5725eaad49dbf5b3a05c27b0b3677af69f64c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 9 Oct 2006 19:56:04 +0200 Subject: [PATCH] [PATCH] Don't hardcode ioengine path Use the prefix in the Makefile, so it can be packaged properly. Signed-off-by: Jens Axboe --- Makefile | 14 +++++++++----- fio.c | 1 + fio.h | 1 + ioengines.c | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 5335e145..f6001ad3 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,15 @@ CFLAGS = -Wall -O2 -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 PROGS = fio SCRIPTS = fio_generate_plots +INSTALL = install +prefix = /usr/local +bindir = $(prefix)/bin +libdir = $(prefix)/lib/fio + +FIO_INST_DIR = $(subst ','\'',$(prefix)) + +CFLAGS += '-D_INST_PREFIX="$(FIO_INST_DIR)"' + all: depend $(PROGS) $(SCRIPTS) $(MAKE) -C engines @@ -18,11 +27,6 @@ depend: cscope: @cscope -b -INSTALL = install -prefix = /usr/local -bindir = $(prefix)/bin -libdir = $(prefix)/lib/fio - install: $(PROGS) $(SCRIPTS) $(INSTALL) -m755 -d $(DESTDIR)$(bindir) $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir) diff --git a/fio.c b/fio.c index a2651f03..8278b60e 100644 --- a/fio.c +++ b/fio.c @@ -45,6 +45,7 @@ static char run_str[MAX_JOBS + 1]; int shm_id = 0; static struct timeval genesis; static int temp_stall_ts; +char *fio_inst_prefix = _INST_PREFIX; static void print_thread_status(void); diff --git a/fio.h b/fio.h index 64f3b2d1..112736c8 100644 --- a/fio.h +++ b/fio.h @@ -325,6 +325,7 @@ extern int groupid; extern int terse_output; extern FILE *f_out; extern FILE *f_err; +extern char *fio_inst_prefix; extern struct thread_data *threads; diff --git a/ioengines.c b/ioengines.c index 17909636..82b7ec3f 100644 --- a/ioengines.c +++ b/ioengines.c @@ -31,7 +31,7 @@ struct ioengine_ops *load_ioengine(struct thread_data *td, char *name) if (!strncmp(engine, "linuxaio", 8) || !strncmp(engine, "aio", 3)) strcpy(engine, "libaio"); - sprintf(engine_lib, "/usr/local/lib/fio/fio-engine-%s.o", engine); + sprintf(engine_lib, "%s/lib/fio/fio-engine-%s.o", fio_inst_prefix, engine); dlerror(); dlhandle = dlopen(engine_lib, RTLD_LAZY); if (!dlhandle) { -- 2.25.1