Skip to content

Commit

Permalink
Only build scsidump when building for the FULLSPEC board (#1285) (#1286
Browse files Browse the repository at this point in the history
)

* Only build scsidump when building for the FULLSPEC board

* Only install scsidump manpage when building for the FULLSPEC board

* Only install scsidump binary when building for the FULLSPEC board

* Revert debug optimization back to -O0, -Og omits some information
  • Loading branch information
uweseimet committed Nov 8, 2023
1 parent f091128 commit d3ee8b6
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CXX = $(CROSS_COMPILE)g++
DEBUG ?= 0
ifeq ($(DEBUG), 1)
# Debug compiler flags
CXXFLAGS += -Og -g -Wall -Wextra -DDEBUG
CXXFLAGS += -O0 -g -Wall -Wextra -DDEBUG
else
# Release compiler flags
CXXFLAGS += -O3 -Wall -Werror -Wextra -DNDEBUG
Expand All @@ -39,7 +39,7 @@ CXXFLAGS += $(EXTRA_FLAGS)
CONNECT_TYPE ?= FULLSPEC

ifdef CONNECT_TYPE
CXXFLAGS += -DCONNECT_TYPE_$(CONNECT_TYPE)
CXXFLAGS += -DCONNECT_TYPE_$(CONNECT_TYPE)
endif

PISCSI = piscsi
Expand Down Expand Up @@ -67,9 +67,13 @@ BIN_ALL = \
$(BINDIR)/$(PISCSI) \
$(BINDIR)/$(SCSICTL) \
$(BINDIR)/$(SCSIMON) \
$(BINDIR)/$(SCSIDUMP) \
$(BINDIR)/$(SCSILOOP)

# scsidump requires initiator support
ifeq ($(CONNECT_TYPE), FULLSPEC)
BIN_ALL += $(BINDIR)/$(SCSIDUMP)
endif

SRC_PROTOC = piscsi_interface.proto

SRC_GENERATED = $(GENERATED_DIR)/piscsi_interface.pb.cpp
Expand Down Expand Up @@ -128,6 +132,22 @@ OBJ_SHARED := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SHARED:%.cpp=%.o)))
OBJ_PROTOBUF := $(addprefix $(OBJDIR)/,$(notdir $(SRC_PROTOBUF:%.cpp=%.o)))
OBJ_GENERATED := $(addprefix $(OBJDIR)/,$(notdir $(SRC_GENERATED:%.cpp=%.o)))

BINARIES = $(USR_LOCAL_BIN)/$(SCSICTL) \
$(USR_LOCAL_BIN)/$(PISCSI) \
$(USR_LOCAL_BIN)/$(SCSIMON) \
$(USR_LOCAL_BIN)/$(SCSILOOP)
ifeq ($(CONNECT_TYPE), FULLSPEC)
BINARIES += $(USR_LOCAL_BIN)/$(SCSIDUMP)
endif

MAN_PAGES = $(MAN_PAGE_DIR)/piscsi.1 \
$(MAN_PAGE_DIR)/scsictl.1 \
$(MAN_PAGE_DIR)/scsimon.1 \
$(MAN_PAGE_DIR)/scsiloop.1
ifeq ($(CONNECT_TYPE), FULLSPEC)
MAN_PAGES += $(MAN_PAGE_DIR)/scsidump.1
endif

GENERATED_DIR := generated

# For the unit tests, the following functions will be "wrapped" by the linker, meaning the
Expand Down Expand Up @@ -232,16 +252,8 @@ clean:
## * sudo systemctl start piscsi
.PHONY: install
install: \
$(MAN_PAGE_DIR)/piscsi.1 \
$(MAN_PAGE_DIR)/scsictl.1 \
$(MAN_PAGE_DIR)/scsimon.1 \
$(MAN_PAGE_DIR)/scsiloop.1 \
$(MAN_PAGE_DIR)/scsidump.1 \
$(USR_LOCAL_BIN)/$(SCSICTL) \
$(USR_LOCAL_BIN)/$(PISCSI) \
$(USR_LOCAL_BIN)/$(SCSIMON) \
$(USR_LOCAL_BIN)/$(SCSILOOP) \
$(USR_LOCAL_BIN)/$(SCSIDUMP) \
$(MAN_PAGES) \
$(BINARIES) \
$(SYSTEMD_CONF) \
$(RSYSLOG_CONF) \
$(RSYSLOG_LOG)
Expand Down

0 comments on commit d3ee8b6

Please sign in to comment.