Skip to content

Instantly share code, notes, and snippets.

@hemmer
Created May 6, 2022 05:44
Show Gist options
  • Save hemmer/ac8a7667ab94fbfbaf2cf40051382143 to your computer and use it in GitHub Desktop.
Save hemmer/ac8a7667ab94fbfbaf2cf40051382143 to your computer and use it in GitHub Desktop.
diff --git a/Makefile b/Makefile
index 74044665..9f048f58 100644
--- a/Makefile
+++ b/Makefile
@@ -106,7 +106,7 @@ cleandep:
$(MAKE) -C dep clean
run: $(STANDALONE_TARGET)
- ./$< -d
+ valgrind --track-origins=yes ./$< -d
runr: $(STANDALONE_TARGET)
./$<
diff --git a/arch.mk b/arch.mk
index 5a5f22e8..180d8918 100644
--- a/arch.mk
+++ b/arch.mk
@@ -8,8 +8,13 @@ else ifneq (,$(findstring i686-,$(MACHINE)))
ARCH_NAME := x86
else ifneq (,$(findstring arm64-apple,$(MACHINE)))
ARCH_ARM := 1
- ARCH_ARM_APPLE := 1
+ ARCH_ARM_APPLE := 1
ARCH_NAME := apple-m1
+else ifneq (,$(findstring linux-gnu,$(MACHINE)))
+ ARCH_ARM := 1
+ ARCH_ARM_LINUX := 1
+ ARCH_NAME := linux-arm
+
else
$(error Could not determine CPU architecture of $(MACHINE). Try hacking around in arch.mk)
endif
diff --git a/compile.mk b/compile.mk
index 63604149..ff730ad8 100644
--- a/compile.mk
+++ b/compile.mk
@@ -23,9 +23,13 @@ CXXFLAGS += -std=c++11
# CPU architecture set.
ifdef ARCH_ARM_APPLE
FLAGS += -mcpu=apple-m1
+else
+ifdef ARCH_ARM_LINUX
+ FLAGS += -march=armv8-a
else
FLAGS += -march=nehalem
endif
+endif
# Set arm architecture to switch sse instructions to use sse2neon.h
ifdef ARCH_ARM
diff --git a/dep.mk b/dep.mk
index 43b8ba7f..00c182df 100644
--- a/dep.mk
+++ b/dep.mk
@@ -10,11 +10,15 @@ DEP_FLAGS += -g -O3
# Static libs don't usually compiled with -fPIC, but since we're including them in a shared library, it's needed.
DEP_FLAGS += -fPIC
-# CPU architecture detect
+# CPU architecture set.
ifdef ARCH_ARM_APPLE
- DEP_FLAGS += -mcpu=apple-m1
+ FLAGS += -mcpu=apple-m1
else
- DEP_FLAGS += -march=nehalem
+ifdef ARCH_ARM_LINUX
+ FLAGS += -march=armv8-a
+else
+ FLAGS += -march=nehalem
+endif
endif
ifdef ARCH_MAC
diff --git a/dep/Makefile b/dep/Makefile
index 18a62b73..03de03ec 100644
--- a/dep/Makefile
+++ b/dep/Makefile
@@ -169,6 +169,10 @@ $(libarchive): | $(zstd) libarchive-3.4.3
SPEEXDSP_CONFIGURE_FLAGS := ""
ifdef ARCH_ARM_APPLE
SPEEXDSP_CONFIGURE_FLAGS += -disable-neon
+else
+ifdef ARCH_ARM_LINUX
+ SPEEXDSP_CONFIGURE_FLAGS += -disable-neon
+endif
endif
speexdsp-SpeexDSP-1.2rc3:
@@ -189,7 +193,7 @@ libsamplerate-0.1.9:
rm libsamplerate-0.1.9.tar.gz
$(libsamplerate): | libsamplerate-0.1.9
- cd libsamplerate-0.1.9 && $(CONFIGURE) --disable-fftw --disable-sndfile
+ cd libsamplerate-0.1.9 && ./configure --prefix="/home/parallels/Documents/Code/Rack/dep" --build=unknown-unknown-linux --disable-fftw --disable-sndfile
$(MAKE) -C libsamplerate-0.1.9
$(MAKE) -C libsamplerate-0.1.9 install
@@ -272,4 +276,4 @@ src: glew-2.1.0 glfw jansson-2.12 speexdsp-SpeexDSP-1.2rc3 openssl-1.1.1k curl-7
clean:
git clean -fdx
- git submodule foreach git clean -fdx
\ No newline at end of file
+ git submodule foreach git clean -fdx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment