Skip to content

Commit

Permalink
(enh) Build for Linux on ARM. (#25)
Browse files Browse the repository at this point in the history
* Build for Linux on ARM.
cc does not have a `-m64` option on ARM

* add if conditions to Linux makefile, remove ARM specific project dir

* remove ARM build instruction from README
  • Loading branch information
glennj authored Jul 9, 2024
1 parent e293660 commit 86264af
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions projects/make/wrenc.make
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ ifeq (.exe,$(findstring .exe,$(ComSpec)))
SHELLTYPE := msdos
endif

# This makefile can be used to compile on Linux for ARM cpu,
# but without the `-m64` flag
machine := $(shell uname -m)

# Configurations
# #############################################

Expand All @@ -38,9 +42,14 @@ TARGETDIR = ../../bin
TARGET = $(TARGETDIR)/wrenc
OBJDIR = obj/64bit/Release
DEFINES += -DNDEBUG -D_GNU_SOURCE
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O3 -std=c99
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O3
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O3 -std=c99
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O3
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -s
ifeq ($(machine),x86_64)
ALL_CFLAGS += -m64
ALL_CXXFLAGS += -m64
ALL_LDFLAGS += -m64
endif

else ifeq ($(config),release_32bit)
TARGETDIR = ../../bin
Expand All @@ -65,9 +74,14 @@ TARGETDIR = ../../bin
TARGET = $(TARGETDIR)/wrenc_d
OBJDIR = obj/64bit/Debug
DEFINES += -DDEBUG -D_GNU_SOURCE
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g -std=c99
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -g
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -std=c99
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64
ifeq ($(machine),x86_64)
ALL_CFLAGS += -m64
ALL_CXXFLAGS += -m64
ALL_LDFLAGS += -m64
endif

else ifeq ($(config),debug_32bit)
TARGETDIR = ../../bin
Expand Down Expand Up @@ -481,4 +495,4 @@ $(OBJDIR)/timer1.o: ../../src/module/timer.c
-include $(OBJECTS:%.o=%.d)
ifneq (,$(PCH))
-include $(PCH_PLACEHOLDER).d
endif
endif

0 comments on commit 86264af

Please sign in to comment.