Skip to content

Commit

Permalink
Test the -m32 and -m64 compiler flags before use
Browse files Browse the repository at this point in the history
Fixes: haampie#78
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
  • Loading branch information
ismaell committed Aug 23, 2022
1 parent 87ea31a commit 061d3ec
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions tests/05_32_bits/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

LD_LIBRARY_PATH=

.PHONY: clean
.PHONY: clean check

all: check

Expand All @@ -21,11 +21,21 @@ exe64: lib64/libx.so
exe32: lib32/libx.so
echo 'extern int a(); int _start(){return a();}' | $(CC) -m32 "-Wl,-rpath,$(CURDIR)/lib64" "-Wl,-rpath,$(CURDIR)/lib32" -o $@ -nostdlib -x c - -Llib32 -lx

check: exe32 exe64
../../libtree exe32
../../libtree exe64

clean:
rm -rf lib32 lib64 exe*

CURDIR ?= $(.CURDIR)

test-flag = 2>/dev/null ${CC} -E /dev/null
test-end = && echo y || echo n
support-m32 != ${test-flag} -m32 ${test-end}
support-m64 != ${test-flag} -m64 ${test-end}

check${support-m32:y=}:: exe32
../../libtree exe32

check${support-m64:y=}:: exe64
../../libtree exe64

check${support-m32:n=} check${support-m64:n=}::
@echo WARNING: test skipped at ${CURDIR}

0 comments on commit 061d3ec

Please sign in to comment.