diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6449fb2 --- /dev/null +++ b/Makefile @@ -0,0 +1,53 @@ +######################################################################## +# # +# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com> # +# This file is part of gluster-block. # +# # +# This file is licensed to you under your choice of the GNU Lesser # +# General Public License, version 3 or any later version (LGPLv3 or # +# later), or the GNU General Public License, version 2 (GPLv2), in all# +# cases as published by the Free Software Foundation. # +# # +######################################################################## + +CC = gcc + +BIN = gluster-block +OBJS = glfs-operations.o ssh-common.o utils.o gluster-block.o + +CFLAGS = -g -Wall +LIBS := $(shell pkg-config --libs uuid glusterfs-api libssh) + +DEPS_LIST = gcc tcmu-runner targetcli + +PREFIX ?= /usr/local/sbin +MKDIR_P = mkdir -p +LOGDIR = /var/log/ + + +all: $(BIN) + +$(BIN): $(OBJS) + @$(MKDIR_P) $(LOGDIR)$@ + $(CC) $(CFLAGS) $(LIBS) $^ -o $@ + +glfs-operations.o: glfs-operations.c glfs-operations.h + $(foreach x, $(DEPS_LIST),\ + $(if $(shell which $x), \ + $(info -- found $x),\ + $(else, \ + $(error "No $x in PATH, install '$x' and continue ...")))) + $(CC) $(CFLAGS) -c $< -o $@ + +$(BIN).o: $(BIN).c + $(CC) $(CFLAGS) -c $< -o $@ + +install: $(BIN) + cp $< $(PREFIX)/ + +.PHONY: clean distclean +clean distclean: + rm -f ./*.o $(BIN) + +uninstall: + rm -f $(PREFIX)/$(BIN) |