blob: 3bcbfd66ad48a3fa6cffb84cdf7c177a1995dc3b [file] [log] [blame] [raw]
CC := gcc
#CC := gcc-4.3.2-gld
INSTALL ?= install
CFLAGS += -std=gnu99 -Wall -Wno-unused-value -Os
CFLAGS += -I include
#CFLAGS += -D DEBUG=1
# For Solaris only
#CFLAGS += -D HAVE_LIBDEVINFO=1
#LIBS += -l devinfo
# Required for BSD make
CFLAGS += $(CPPFLAGS)
PREFIX ?= /usr/local
SBINDIR ?= $(PREFIX)/sbin
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(DATADIR)/man
PROG := mfiutil
MANPAGE := mfiutil.8
SRCS:= mfiutil.c mfi_bbu.c mfi_cmd.c mfi_config.c mfi_drive.c mfi_evt.c \
mfi_flash.c mfi_patrol.c mfi_show.c mfi_volume.c mfi_foreign.c \
mfi_properties.c human_readable.c
OBJECTS = $(addsuffix .o,$(basename $(SRCS))) ${SRCS:R:S/$/.o/g}
default: $(PROG)
$(PROG): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS)
clean:
rm -f $(OBJECTS) $(PROG)
install: $(PROG) $(MANPAGE)
[ -d "$(DESTDIR)$(SBINDIR)" ] || mkdir -p "$(DESTDIR)$(SBINDIR)"
[ -d "$(DESTDIR)$(MANDIR)/man8" ] || mkdir -p "$(DESTDIR)$(MANDIR)/man8"
$(INSTALL) -m 755 $(PROG) "$(DESTDIR)$(SBINDIR)/"
$(INSTALL) -m 644 $(MANPAGE) "$(DESTDIR)$(MANDIR)/man8/"