Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow integration #29

Merged
merged 8 commits into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: C/C++ CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: [push, pull_request]

jobs:
build:
Expand All @@ -15,10 +11,28 @@ jobs:
- name: Install cross compile toolchain
run: sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
- uses: actions/checkout@v2
- name: make
run: make all DEBUG=1

- name: make standard
run: make all DEBUG=1 CONNECT_TYPE=STANDARD
working-directory: ./src/raspberrypi

- name: make fullspec
run: make all DEBUG=1 CONNECT_TYPE=FULLSPEC
working-directory: ./src/raspberrypi

# We need to tar the binary outputs to retain the executable
# file permission. Currently, actions/upload-artifact only
# supports .ZIP files.
akuker marked this conversation as resolved.
Show resolved Hide resolved
- name: tar binary outputs
run: tar -czvf rascsi.tar.gz ./bin
working-directory: ./src/raspberrypi

- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: arm-binaries
path: ./src/raspberrypi/rascsi.tar.gz

# buildroot-image:
# runs-on: ubuntu-latest
# steps:
Expand Down
2 changes: 2 additions & 0 deletions src/raspberrypi/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ scsimon
rasctl
sasidump
rasdump
obj
bin
akuker marked this conversation as resolved.
Show resolved Hide resolved
41 changes: 20 additions & 21 deletions src/raspberrypi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ else
CXXFLAGS += -O3 -Wall -Werror
BUILD_TYPE = Release
endif
CFLAGS += -iquote .
CXXFLAGS += -std=c++14 -iquote .
CFLAGS += -iquote . -MD -MP
CXXFLAGS += -std=c++14 -iquote . -MD -MP

# If its not specified, build for STANDARD configuration
CONNECT_TYPE ?= STANDARD
Expand All @@ -39,8 +39,8 @@ USR_LOCAL_BIN = /usr/local/bin
MAN_PAGE_DIR = /usr/share/man/man1
DOC_DIR = ../../doc

OBJDIR := ./obj
BINDIR := ./bin
OBJDIR := ./obj/$(shell echo $(CONNECT_TYPE) | tr '[:upper:]' '[:lower:]')
BINDIR := ./bin/$(shell echo $(CONNECT_TYPE) | tr '[:upper:]' '[:lower:]')

#BIN_ALL = $(RASCSI) $(RASCTL) $(RASDUMP) $(SASIDUMP) $(SCSIMON)
# Temporarily remove the RASDUMP and RASDUMP tools, since they're not needed
Expand All @@ -58,8 +58,8 @@ SRC_RASCSI = \
# rasctl_command.cpp
# rascsi_mgr.cpp
# command_thread.cpp
SRC_RASCSI += $(notdir $(shell find ./controllers -name '*.cpp'))
SRC_RASCSI += $(notdir $(shell find ./devices -name '*.cpp'))
SRC_RASCSI += $(shell find ./controllers -name '*.cpp')
SRC_RASCSI += $(shell find ./devices -name '*.cpp')

SRC_RASCTL = \
rasctl.cpp
Expand All @@ -85,39 +85,38 @@ vpath %.o ./$(OBJDIR)
vpath ./$(BINDIR)


OBJ_RASCSI := $(SRC_RASCSI:%.cpp=$(OBJDIR)/%.o)
OBJ_RASCTL := $(SRC_RASCTL:%.cpp=$(OBJDIR)/%.o)
OBJ_RASDUMP := $(SRC_RASDUMP:%.cpp=$(OBJDIR)/%.o)
OBJ_SASIDUMP := $(SRC_SASIDUMP:%.cpp=$(OBJDIR)/%.o)
OBJ_SCSIMON := $(SRC_SCSIMON:%.cpp=$(OBJDIR)/%.o)
OBJ_RASCSI := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASCSI:%.cpp=%.o)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you started the compilation and linker rules with @mkdir -p $(dir $@), you could keep the directories in the path and revert the path manipulation you added. (also remove the dirs from prereqs)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of having shell commands inline in the makefile. I prefer to use the target/prerequisites functionality of make. Are you OK with leaving this the way it is?

OBJ_RASCTL := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASCTL:%.cpp=%.o)))
OBJ_RASDUMP := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASDUMP:%.cpp=%.o)))
OBJ_SASIDUMP := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SASIDUMP:%.cpp=%.o)))
OBJ_SCSIMON := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SCSIMON:%.cpp=%.o)))
#OBJ_ALL := $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SASIDUMP) $(OBJ_SCSIMON)
OBJ_ALL := $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SASIDUMP)


# The following will include all of the auto-generated dependency files (*.d)
# if they exist. This will trigger a rebuild of a source file if a header changes
ALL_DEPS := $(patsubst %.o,%.d,$(OBJ_RASCSI) $(OBJ_RASCTL))
-include $(ALL_DEPS)

$(OBJDIR) $(BINDIR):
echo Creating directory $@
mkdir -p $@

$(OBJDIR)/%.o: %.cpp $(OBJDIR)
$(OBJDIR)/%.o: %.cpp | $(OBJDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@

# $(OBJDIR)/%.o: %.c
# $(CXX) $(CXXFLAGS) -c $< -o $@

# %.o: %.cpp
# $(CXX) $(CXXFLAGS) -c $(OBJDIR)/$< -o $@

.DEFAULT_GOAL := all
.PHONY: all ALL docs
all: $(BIN_ALL) docs
ALL: all

docs: $(DOC_DIR)/rascsi_man_page.txt $(DOC_DIR)/rasctl_man_page.txt

$(BINDIR)/$(RASCSI): $(OBJ_RASCSI) $(BINDIR)
@echo -- Linking $(RASCSI)
$(BINDIR)/$(RASCSI): $(OBJ_RASCSI) | $(BINDIR)
$(CXX) -o $@ $(OBJ_RASCSI) -lpthread

$(BINDIR)/$(RASCTL): $(OBJ_RASCTL) $(BINDIR)
@echo -- Linking $(RASCTL)
$(CXX) -o $@ $(OBJ_RASCTL)

$(RASDUMP): $(OBJ_RASDUMP) $(BINDIR)
Expand Down