fix -m32 on arm 32 bit (is -m32be). make 32 and 64 bit varaints optional
@@ -24,18 +24,28 @@ ifneq "$(filter Linux GNU%,$(shell uname))" ""
LDFLAGS += -ldl
endif
+# on gcc for arm there is no -m32, but -mbe32
+M32FLAG = -m32
+M64FLAG = -m64
+ifeq "$(findstring clang, $(shell $(CC) --version 2>/dev/null))" ""
+ ifneq (,$(findstring arm, "$(shell $(CC) -v 2>&1 >/dev/null)"))
+ M32FLAG = -mbe32
+ endif
+endif
+
+
all: argvfuzz32.so argvfuzz64.so
argvfuzz32.so: argvfuzz.c
- -$(CC) -m32 $(CFLAGS) $^ $(LDFLAGS) -o $@ || echo "argvfuzz32 build failure (that's fine)"
+ -$(CC) $(M32FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ || echo "argvfuzz32 build failure (that's fine)"
argvfuzz64.so: argvfuzz.c
- -$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
+ -$(CC) $(M64FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ || echo "argvfuzz64 build failure (that's fine)"
install: argvfuzz32.so argvfuzz64.so
install -d -m 755 $(DESTDIR)$(HELPER_PATH)/
if [ -f argvfuzz32.so ]; then set -e; install -m 755 argvfuzz32.so $(DESTDIR)$(HELPER_PATH)/; fi
- install -m 755 argvfuzz64.so $(DESTDIR)$(HELPER_PATH)/
+ if [ -f argvfuzz64.so ]; then set -e; install -m 755 argvfuzz64.so $(DESTDIR)$(HELPER_PATH)/; fi
clean:
rm -f argvfuzz32.so argvfuzz64.so
