aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpulib/gpulib.mak
blob: ad6a8ad97aed120a73cad439a7bb69d46af5c839 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# depends on ARCH definition
# always adding gpulib to deps in case cspace is needed
# users must include ../../config.mak

LDFLAGS += -shared -Wl,--no-undefined
CFLAGS += $(PLUGIN_CFLAGS)
ifeq "$(ARCH)" "arm"
 EXT =
else
 #LDLIBS_GPULIB += `sdl-config --libs`
 EXT = .$(ARCH)
endif
ifdef DEBUG
 CFLAGS += -O0
endif

GPULIB_A = ../gpulib/gpulib$(EXT).a

ifdef BIN_STANDLALONE
TARGETS += $(BIN_STANDLALONE)
endif
ifdef BIN_GPULIB
TARGETS += $(BIN_GPULIB)
endif
CC_STANDLALONE = $(CC)
CC_GPULIB = $(CC)

WD = $(shell pwd)
PLUGINDIR = $(shell basename $(WD))

all: ../../config.mak $(TARGETS)

ifdef BIN_STANDLALONE
ifneq ($(findstring .cpp,$(SRC_STANDALONE)),)
CC_STANDLALONE = $(CXX)
endif
$(BIN_STANDLALONE): $(SRC) $(SRC_STANDALONE) $(GPULIB_A)
	$(CC_STANDLALONE) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_STANDALONE)
	ln -fs $(PLUGINDIR)/$@ ../
endif

ifdef BIN_GPULIB
ifneq ($(findstring .cpp,$(SRC_GPULIB)),)
CC_GPULIB = $(CXX)
endif
$(BIN_GPULIB): $(SRC) $(SRC_GPULIB) $(GPULIB_A)
	$(CC_GPULIB) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_GPULIB)
	ln -fs $(PLUGINDIR)/$@ ../
endif

$(GPULIB_A):
	make -C ../gpulib/ all

clean:
	$(RM) $(TARGETS)

../../config.mak:
	@echo "Please run ./configure before running make!"
	@exit 1