Makefile: use ginstall on Solaris
[fio.git] / Makefile
index 023557c05a323bfa88e847671ba5990602f09530..a5322a9c5fd0a22e3098028ee78f7b795d18fadc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,3 @@
-DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
-CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(DEBUGFLAGS)
-OPTFLAGS= -O3 -g -ffast-math $(EXTFLAGS)
-CFLAGS = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS)
-LIBS   = -lm $(EXTLIBS)
-PROGS  = fio
-SCRIPTS = fio_generate_plots
-UNAME  := $(shell uname)
-
 ifneq ($(wildcard config-host.mak),)
 all:
 include config-host.mak
@@ -21,6 +12,14 @@ all:
 include config-host.mak
 endif
 
+DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
+CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(DEBUGFLAGS)
+OPTFLAGS= -O3 -g -ffast-math
+CFLAGS = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS) $(EXTFLAGS) $(BUILD_CFLAGS)
+LIBS   += -lm $(EXTLIBS)
+PROGS  = fio
+SCRIPTS = fio_generate_plots
+
 SOURCE := gettime.c fio.c ioengines.c init.c stat.c log.c time.c filesetup.c \
                eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \
                rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \
@@ -73,6 +72,9 @@ endif
 ifndef CONFIG_STRSEP
   SOURCE += lib/strsep.c
 endif
+ifndef CONFIG_STRCASESTR
+  SOURCE += lib/strcasestr.c
+endif
 ifndef CONFIG_GETOPT_LONG_ONLY
   SOURCE += lib/getopt_long.c
 endif
@@ -80,42 +82,42 @@ ifndef CONFIG_INET_ATON
   SOURCE += lib/inet_aton.c
 endif
 
-ifeq ($(UNAME), Linux)
+ifeq ($(CONFIG_TARGET_OS), Linux)
   SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \
                engines/binject.c profiles/tiobench.c
   LIBS += -lpthread -ldl
   LDFLAGS += -rdynamic
 endif
-ifeq ($(UNAME), Android)
+ifeq ($(CONFIG_TARGET_OS), Android)
   SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c
   LIBS += -ldl
   LDFLAGS += -rdynamic
 endif
-ifeq ($(UNAME), SunOS)
+ifeq ($(CONFIG_TARGET_OS), SunOS)
   LIBS  += -lpthread -ldl
   CPPFLAGS += -D__EXTENSIONS__
 endif
-ifeq ($(UNAME), FreeBSD)
+ifeq ($(CONFIG_TARGET_OS), FreeBSD)
   LIBS  += -lpthread -lrt
   LDFLAGS += -rdynamic
 endif
-ifeq ($(UNAME), NetBSD)
+ifeq ($(CONFIG_TARGET_OS), NetBSD)
   LIBS  += -lpthread -lrt
   LDFLAGS += -rdynamic
 endif
-ifeq ($(UNAME), AIX)
+ifeq ($(CONFIG_TARGET_OS), AIX)
   LIBS  += -lpthread -ldl -lrt
   CPPFLAGS += -D_LARGE_FILES -D__ppc__
   LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000
 endif
-ifeq ($(UNAME), HP-UX)
+ifeq ($(CONFIG_TARGET_OS), HP-UX)
   LIBS   += -lpthread -ldl -lrt
   CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED
 endif
-ifeq ($(UNAME), Darwin)
+ifeq ($(CONFIG_TARGET_OS), Darwin)
   LIBS  += -lpthread -ldl
 endif
-ifneq (,$(findstring CYGWIN,$(UNAME)))
+ifneq (,$(findstring CYGWIN,$(CONFIG_TARGET_OS)))
   SOURCE := $(filter-out engines/mmap.c,$(SOURCE))
   SOURCE += os/windows/posix.c
   LIBS  += -lpthread -lpsapi -lws2_32
@@ -165,11 +167,15 @@ ifndef V
 endif
 endif
 
-INSTALL = install
+ifeq ($(CONFIG_TARGET_OS), SunOS)
+       INSTALL = ginstall
+else
+       INSTALL = install
+endif
 prefix = /usr/local
 bindir = $(prefix)/bin
 
-ifeq ($(UNAME), Darwin)
+ifeq ($(CONFIG_TARGET_OS), Darwin)
 mandir = /usr/share/man
 else
 mandir = $(prefix)/man
@@ -217,7 +223,7 @@ fio: $(OBJS)
        $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
 
 clean: FORCE
-       -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak cscope.out *.d
+       -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak config-host.h cscope.out *.d
 
 cscope:
        @cscope -b -R