From a0f93bd4ca31991b6265bb96bd0ac3f9c66ef244 Mon Sep 17 00:00:00 2001 From: danghvu Date: Thu, 28 Nov 2013 02:46:15 -0600 Subject: [PATCH 1/2] Shorten tests/Makefile --- tests/Makefile | 48 +++++++++++++++--------------------------------- 1 file changed, 15 insertions(+), 33 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index f8baa5e1aa..432b76a0aa 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -10,46 +10,28 @@ CFLAGS += -fPIC -O3 -Wall -I$(INCDIR) -L$(LIBDIR) LIBNAME = capstone -.PHONY: all clean win_test +.PHONY: all clean win_test linux windows -all: test test_detail test_x86 test_arm64 test_arm test_mips +SOURCES = test.c test_detail.c test_x86.c test_arm64.c test_arm.c test_mips.c +OBJS = $(SOURCES:.c=.o) +BINARY_LINUX = $(SOURCES:.c=) +BINARY_WINDOWS = $(SOURCES:.c=.exe) -test: test.o - ${CC} $(CFLAGS) test.o -O3 -Wall -l$(LIBNAME) -o test +all: linux -test_detail: test_detail.o - ${CC} $(CFLAGS) test_detail.o -O3 -Wall -l$(LIBNAME) -o test_detail - -test_x86: test_x86.o - ${CC} $(CFLAGS) test_x86.o -O3 -Wall -l$(LIBNAME) -o test_x86 - -test_arm64: test_arm64.o - ${CC} $(CFLAGS) test_arm64.o -O3 -Wall -l$(LIBNAME) -o test_arm64 - -test_arm: test_arm.o - ${CC} $(CFLAGS) test_arm.o -O3 -Wall -l$(LIBNAME) -o test_arm - -test_mips: test_mips.o - ${CC} $(CFLAGS) test_mips.o -O3 -Wall -l$(LIBNAME) -o test_mips +linux: $(OBJS) $(BINARY_LINUX) # Mingw32 -windows: test.o test_detail.o test_x86.o test_arm64.o test_arm.o test_mips.o - ${CC} test.o -O3 -Wall $(LIBNAME).dll -o test.exe - ${CC} test_detail.o -O3 -Wall $(LIBNAME).dll -o test_detail.exe - ${CC} test_x86.o -O3 -Wall $(LIBNAME).dll -o test_x86.exe - ${CC} test_arm64.o -O3 -Wall $(LIBNAME).dll -o test_arm64.exe - ${CC} test_arm.o -O3 -Wall $(LIBNAME).dll -o test_arm.exe - ${CC} test_mips.o -O3 -Wall $(LIBNAME).dll -o test_mips.exe +windows: $(OBJS) $(BINARY_WINDOWS) clean: - rm -rf test_x86 test_x86.exe test_x86.o - rm -rf test_arm64 test_arm64.exe test_arm64.o - rm -rf test_arm test_arm.exe test_arm.o - rm -rf test_mips test_mips.exe test_mips.o - rm -rf test test.exe test.o - rm -rf test_detail test_detail.exe test_detail.o - rm -rf *.dll - rm -rf *.so + rm -rf $(OBJS) $(BINARY_LINUX) $(BINARY_WINDOWS) *.dll *.so + +%.exe: %.o + ${CC} $(CFLAGS) $^ -O3 -Wall $(LIBNAME).dll -o $@ + +%: %.o + ${CC} $(CFLAGS) $^ -O3 -Wall -l$(LIBNAME) -o $@ .c.o: ${CC} ${CFLAGS} -c $< -o $@ From 2e19d93db8f0cd4aa4b6bbb23bb4e1cf593a3f51 Mon Sep 17 00:00:00 2001 From: danghvu Date: Thu, 28 Nov 2013 03:06:31 -0600 Subject: [PATCH 2/2] More generic name for *nix target --- tests/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 432b76a0aa..b31bbba4f4 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -17,9 +17,9 @@ OBJS = $(SOURCES:.c=.o) BINARY_LINUX = $(SOURCES:.c=) BINARY_WINDOWS = $(SOURCES:.c=.exe) -all: linux +all: nix -linux: $(OBJS) $(BINARY_LINUX) +nix: $(OBJS) $(BINARY_LINUX) # Mingw32 windows: $(OBJS) $(BINARY_WINDOWS)