Blame usr/Makefile

Packit Service 646995
# This Makefile will work only with GNU make.
Packit Service 646995
Packit Service 646995
ifeq ($(TOPDIR),)
Packit Service 646995
	TOPDIR = ..
Packit Service 646995
endif
Packit Service 646995
Packit Service 646995
OSNAME=$(shell uname -s)
Packit Service 646995
Packit Service 646995
# allow users to override these
Packit Service 646995
# eg to compile for a kernel that you aren't currently running
Packit Service 646995
KERNELRELEASE ?= $(shell uname -r)
Packit Service 646995
KSRC ?= /lib/modules/$(KERNELRELEASE)/build
Packit Service 646995
Packit Service 646995
KSUBLEVEL=$(shell cat $(KSRC)/Makefile | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
Packit Service 646995
			sed 's/^[ \t]*//;s/[ \t]*$$//')
Packit Service 646995
Packit Service 646995
ifeq ($(OSNAME),Linux)
Packit Service 646995
	ifeq ($(KSUBLEVEL),11)
Packit Service 646995
		IPC_CFLAGS=-DNETLINK_ISCSI=12 -D_GNU_SOURCE
Packit Service 646995
	else
Packit Service 646995
	ifeq ($(KSUBLEVEL),12)
Packit Service 646995
		IPC_CFLAGS=-DNETLINK_ISCSI=12 -D_GNU_SOURCE
Packit Service 646995
	else
Packit Service 646995
		IPC_CFLAGS=-DNETLINK_ISCSI=8 -D_GNU_SOURCE
Packit Service 646995
	endif
Packit Service 646995
	endif
Packit Service 646995
IPC_OBJ=netlink.o
Packit Service 646995
else
Packit Service 646995
ifeq ($(OSNAME),FreeBSD)
Packit Service 646995
IPC_CFLAGS=
Packit Service 646995
IPC_OBJ=ioctl.o
Packit Service 646995
endif
Packit Service 646995
endif
Packit Service 646995
Packit Service 646995
PKG_CONFIG = /usr/bin/pkg-config
Packit Service 646995
Packit Service 646995
CFLAGS ?= -O2 -g
Packit Service 6dc881
WARNFLAGS ?= -Wall -Wextra -Wstrict-prototypes -fno-common
Packit Service 646995
CFLAGS += $(WARNFLAGS) -I../include -I. -D_GNU_SOURCE \
Packit Service 2a7015
	  -I$(TOPDIR)/libopeniscsiusr -DISNS_ENABLE
Packit Service 646995
CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod)
Packit Service 646995
ISCSI_LIB = -L$(TOPDIR)/libopeniscsiusr -lopeniscsiusr
Packit Service 646995
LDFLAGS += $(shell $(PKG_CONFIG) --libs libkmod)
Packit Service 646995
ifeq ($(NO_SYSTEMD),)
Packit Service 646995
LDFLAGS += $(shell $(PKG_CONFIG) --libs libsystemd)
Packit Service 646995
endif
Packit Service 646995
PROGRAMS = iscsid iscsiadm iscsistart
Packit Service 646995
Packit Service 646995
# libc compat files
Packit Service 646995
SYSDEPS_SRCS = $(sort $(wildcard ../utils/sysdeps/*.o))
Packit Service 646995
# sources shared between iscsid, iscsiadm and iscsistart
Packit Service 646995
ISCSI_LIB_SRCS = iscsi_util.o io.o auth.o iscsi_timer.o login.o log.o \
Packit Service 646995
	iface.o idbm.o sysfs.o host.o session_info.o iscsi_sysfs.o \
Packit Service 646995
	iscsi_net_util.o iscsid_req.o transport.o iser.o cxgbi.o be2iscsi.o \
Packit Service 646995
	initiator_common.o iscsi_err.o flashnode.o uip_mgmt_ipc.o \
Packit Service 646995
	netlink.o $(SYSDEPS_SRCS)
Packit Service 646995
# core initiator files
Packit Service 646995
INITIATOR_SRCS = initiator.o scsi.o actor.o event_poll.o mgmt_ipc.o kern_err_table.o
Packit Service 646995
Packit Service 646995
# fw boot files
Packit Service 646995
FW_BOOT_SRCS = $(sort $(wildcard ../utils/fwparam_ibft/*.o))
Packit Service 646995
Packit Service 646995
# core discovery files
Packit Service 646995
DISCOVERY_SRCS = $(FW_BOOT_SRCS) local_strings.o discovery.o
Packit Service 646995
Packit Service 646995
all: $(PROGRAMS)
Packit Service 646995
Packit Service 646995
iscsid: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \
Packit Service 646995
	iscsid.o session_mgmt.o discoveryd.o mntcheck.o
Packit Service 646995
	$(CC) $(CFLAGS) $^ -o $@  -lisns -lcrypto -lrt -lmount $(LDFLAGS) $(ISCSI_LIB)
Packit Service 646995
Packit Service 646995
iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o mntcheck.o
Packit Service 646995
	$(CC) $(CFLAGS) $^ -o $@ -lisns -lcrypto -lmount $(LDFLAGS) $(ISCSI_LIB)
Packit Service 646995
Packit Service 646995
iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
Packit Service 646995
		iscsistart.o statics.o
Packit Service 646995
	$(CC) $(CFLAGS) $^ -o $@ -lcrypto -lrt $(LDFLAGS) $(ISCSI_LIB)
Packit Service 646995
clean:
Packit Service 646995
	rm -f *.o $(PROGRAMS) .depend $(LIBSYS)
Packit Service 646995
Packit Service 646995
depend:
Packit Service 646995
	gcc $(CFLAGS) -M `ls *.c` > .depend
Packit Service 646995
Packit Service 646995
-include .depend