From edec27d7bf200685396b2839d3f584bcdac7b376 Mon Sep 17 00:00:00 2001 From: ethanckim Date: Sat, 5 Nov 2022 20:12:35 +0000 Subject: [PATCH 1/4] Install arm-linux cross compiler with makefile --- .gitignore | 2 ++ Makefile | 9 +++++++++ README.md | 3 +++ 3 files changed, 14 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c8d2361 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build +downloads \ No newline at end of file diff --git a/Makefile b/Makefile index e69de29..223e139 100644 --- a/Makefile +++ b/Makefile @@ -0,0 +1,9 @@ +gcc-arm-linux-gnueabihf: + mkdir -p $(@D)/downloads + wget -c -O $(@D)/downloads/gcc-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 + mkdir -p $(@D)/build + tar -xf $(@D)/downloads/gcc-arm-linux-gnueabihf.tar.xz -C $(@D)/build + +clean: + rm -rf $(@D)/build + rm -rf $(@D)/downloads \ No newline at end of file diff --git a/README.md b/README.md index e69de29..43dec80 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,3 @@ +# Relay (C++) +The Relay C++ rewrite is currently a WIP. + From 5207ec8ce17a0aae7fb246946ccd61a816cdcab1 Mon Sep 17 00:00:00 2001 From: Ethan Kim Date: Sat, 12 Nov 2022 18:26:22 +0000 Subject: [PATCH 2/4] Update README --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 43dec80..42cbb3b 100644 --- a/README.md +++ b/README.md @@ -1,3 +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. From 98285cc48831da1f3a42184f7623928bcc1b6e7e Mon Sep 17 00:00:00 2001 From: Ethan Kim Date: Thu, 24 Nov 2022 01:29:20 +0000 Subject: [PATCH 3/4] compile c files --- Makefile | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 223e139..a83c309 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,31 @@ -gcc-arm-linux-gnueabihf: - mkdir -p $(@D)/downloads - wget -c -O $(@D)/downloads/gcc-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 - mkdir -p $(@D)/build - tar -xf $(@D)/downloads/gcc-arm-linux-gnueabihf.tar.xz -C $(@D)/build +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 + $(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: + $(CC-arm) -o $@ $^ $(CFLAGS) $(C_SOURCES) + +host: + $(CC) -o $@ $^ $(CFLAGS) $(C_SOURCES) clean: - rm -rf $(@D)/build - rm -rf $(@D)/downloads \ No newline at end of file + $(RM) $(@D)/build + $(RM) $(@D)/downloads \ No newline at end of file From 9e4b914529f1ebaf9cc47f8327a6f2e7ddf72802 Mon Sep 17 00:00:00 2001 From: Ethan Kim Date: Sat, 26 Nov 2022 18:21:45 +0000 Subject: [PATCH 4/4] put artifacts in install dir --- .gitignore | 4 +++- Makefile | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index c8d2361..3472a16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +.vscode build -downloads \ No newline at end of file +downloads +install \ No newline at end of file diff --git a/Makefile b/Makefile index a83c309..44555f4 100644 --- a/Makefile +++ b/Makefile @@ -20,11 +20,13 @@ install-toolchain: fi @echo $(PATH) -target: - $(CC-arm) -o $@ $^ $(CFLAGS) $(C_SOURCES) +target: $(C_SOURCES) + $(MKDIR) install + $(CC-arm) -o ./install/$@ $^ $(CFLAGS) -host: - $(CC) -o $@ $^ $(CFLAGS) $(C_SOURCES) +host: $(C_SOURCES) + $(MKDIR) install + $(CC) -o ./install/$@ $^ $(CFLAGS) clean: $(RM) $(@D)/build