Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode
build
downloads
install
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export PATH := $(PATH):$(PWD)/build/arm-linux-gnueabihf/bin

CC := gcc
CC-arm := arm-linux-gnueabihf-gcc
CFLAGS := -Wall
C_SOURCES=$(shell find ./src -name '*.c')
CPP_SOURCES :=$(shell find ./src -name '*.cpp')
RM = rm -rf
MKDIR = mkdir -p

.PHONY: install-toolchain host target clean

install-toolchain:
$(MKDIR) ./downloads

Choose a reason for hiding this comment

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

Can we consider moving this downloads folder into ./build? I'm not sure I like it in the main directory like this.

Also, consider making variables defined near the top of the file for these directories. For example:

BUILD_DIR = ./build

$(MKDIR) ./build
wget -c -O ./downloads/arm-linux-gnueabihf.tar.xz https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/arm-linux-gnueabihf/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz
if [ ! -d ./build/arm-linux-gnueabihf ]; then \
tar -xf ./downloads/arm-linux-gnueabihf.tar.xz -C ./build; \
mv ./build/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf ./build/arm-linux-gnueabihf; \
fi
@echo $(PATH)

target: $(C_SOURCES)
$(MKDIR) install

Choose a reason for hiding this comment

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

I don't like calling this directory install. I think we should put all of our compiled objects into a subdirectory of ./build

$(CC-arm) -o ./install/$@ $^ $(CFLAGS)

Choose a reason for hiding this comment

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

This should work for now, but the typical way to do this is to compile each .c file without linking (the -c flag), then link afterwards as a separate step.


host: $(C_SOURCES)
$(MKDIR) install
$(CC) -o ./install/$@ $^ $(CFLAGS)

clean:
$(RM) $(@D)/build

Choose a reason for hiding this comment

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

I don't think make clean should delete the toolchain. Maybe we can have a clean-toolchain target or something like that.

$(RM) $(@D)/downloads
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Relay (C++)
The Relay C++ rewrite is currently a WIP.

# Getting Started
### Clone the Repository
`git clone https://github.com/waterloop/relay-cpp.git`
### Install the RaspberryPi ARM cross-compiler
Navigate to project directory, then run the command `make` to install the toolchain.