refactor gpu plugins and Makefiles
[pcsx_rearmed.git] / plugins / gpulib / Makefile.test
1 CC = $(CROSS_COMPILE)gcc
2 CXX = $(CROSS_COMPILE)g++
3 CC_ = $(CROSS_COMPILE)gcc
4
5 ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}')
6 HAVE_NEON = $(shell $(CC_) -E -dD $(CFLAGS) gpu.h | grep -q '__ARM_NEON__ 1' && echo 1)
7
8 CFLAGS += -ggdb -Wall -DTEST
9 ifndef DEBUG
10 CFLAGS += -O2
11 endif
12 ifeq "$(ARCH)" "arm"
13 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
14 endif
15 ifeq "$(ARCH)" "x86_64"
16 CFLAGS += -m32
17 endif
18
19 TARGETS = test_neon test_peops test_unai
20
21 SRC += test.c
22
23 all: $(TARGETS)
24
25 test_neon: SRC += ../gpu_neon/psx_gpu_if.c
26 test_neon: CFLAGS += -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
27 ifeq "$(HAVE_NEON)" "1"
28 test_neon: SRC += ../gpu_neon/psx_gpu/psx_gpu_arm_neon.S
29 test_neon: CFLAGS += -DNEON_BUILD
30 else
31 test_neon: CFLAGS += -fno-strict-aliasing
32 endif
33 test_peops: SRC += ../dfxvideo/gpulib_if.c
34 test_peops: CFLAGS += -fno-strict-aliasing
35 test_unai: SRC += ../gpu_unai/gpulib_if.cpp
36 test_unai: CC_ = $(CXX)
37 ifeq "$(ARCH)" "arm"
38 test_unai: SRC += ../gpu_unai/gpu_arm.s
39 endif
40
41 $(TARGETS): $(SRC)
42         $(CC_) -o $@ $(SRC) $(CFLAGS) $(LDFLAGS)
43
44 clean:
45         $(RM) $(TARGETS)