refactor some code + bug fix
[pcsx_rearmed.git] / plugins / gpulib / gpulib.mak
1 # depends on ARCH definition
2 # always adding gpulib to deps (XXX might be no longer needed)
3 # users must include ../../config.mak
4
5 LDFLAGS += -shared -Wl,--no-undefined
6 CFLAGS += $(PLUGIN_CFLAGS)
7 ifeq "$(ARCH)" "arm"
8  EXT =
9 else
10  #LDLIBS_GPULIB += `sdl-config --libs`
11  EXT = .$(ARCH)
12 endif
13 ifdef DEBUG
14  CFLAGS += -O0
15 endif
16
17 GPULIB_A = ../gpulib/gpulib$(EXT).a
18
19 ifdef BIN_STANDALONE
20 TARGETS += $(BIN_STANDALONE)
21 endif
22 ifdef BIN_GPULIB
23 TARGETS += $(BIN_GPULIB)
24 endif
25 CC_STANDLALONE = $(CC)
26 CC_GPULIB = $(CC)
27
28 WD = $(shell pwd)
29 PLUGINDIR = $(shell basename $(WD))
30
31 all: ../../config.mak $(TARGETS)
32
33 ifdef BIN_STANDALONE
34 ifneq ($(findstring .cpp,$(SRC_STANDALONE)),)
35 CC_STANDLALONE = $(CXX)
36 endif
37 $(BIN_STANDALONE): $(SRC) $(SRC_STANDALONE) $(GPULIB_A)
38         $(CC_STANDLALONE) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_STANDALONE)
39         ln -fs $(PLUGINDIR)/$@ ../
40 endif
41
42 ifdef BIN_GPULIB
43 ifneq ($(findstring .cpp,$(SRC_GPULIB)),)
44 CC_GPULIB = $(CXX)
45 endif
46 $(BIN_GPULIB): $(SRC) $(SRC_GPULIB) $(GPULIB_A)
47         $(CC_GPULIB) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_GPULIB)
48         ln -fs $(PLUGINDIR)/$@ ../
49 endif
50
51 $(GPULIB_A):
52         make -C ../gpulib/ all
53
54 clean:
55         $(RM) $(TARGETS)
56
57 ../../config.mak:
58         @echo "Please run ./configure before running make!"
59         @exit 1