| 1 | CC = gcc |
| 2 | CFLAGS = -W -Wall -O2 -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 |
| 3 | PROGS = fio |
| 4 | SCRIPTS = fio_generate_plots |
| 5 | OBJS = fio.o ioengines.o init.o stat.o log.o time.o md5.o crc32.o \ |
| 6 | filesetup.o eta.o verify.o memory.o io_u.o parse.o |
| 7 | |
| 8 | INSTALL = install |
| 9 | prefix = /usr/local |
| 10 | bindir = $(prefix)/bin |
| 11 | libdir = $(prefix)/lib/fio |
| 12 | |
| 13 | FIO_INST_DIR = $(subst ','\'',$(prefix)) |
| 14 | |
| 15 | CFLAGS += '-D_INST_PREFIX="$(FIO_INST_DIR)"' |
| 16 | |
| 17 | all: depend $(PROGS) $(SCRIPTS) |
| 18 | $(MAKE) -C engines |
| 19 | |
| 20 | fio: $(OBJS) |
| 21 | $(CC) $(CFLAGS) -o $@ $(filter %.o,$^) -lpthread -lm -ldl |
| 22 | |
| 23 | clean: |
| 24 | -rm -f *.o .depend cscope.out $(PROGS) engines/*.o |
| 25 | |
| 26 | depend: |
| 27 | @$(CC) -MM $(ALL_CFLAGS) *.c 1> .depend |
| 28 | |
| 29 | cscope: |
| 30 | @cscope -b |
| 31 | |
| 32 | install: $(PROGS) $(SCRIPTS) |
| 33 | $(INSTALL) -m755 -d $(DESTDIR)$(bindir) |
| 34 | $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir) |
| 35 | $(INSTALL) -m755 -d $(DESTDIR) $(libdir) |
| 36 | $(INSTALL) engines/*.o $(libdir) |
| 37 | |
| 38 | ifneq ($(wildcard .depend),) |
| 39 | include .depend |
| 40 | endif |