-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
60 lines (51 loc) · 1.76 KB
/
Makefile
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
60
prefix?=/usr
INSTALL=install
RM=rm -f
uname_m := $(shell uname -m)
ifeq ($(uname_m),x86_64)
platform?=linuxX64
else ifeq ($(uname_m:arm%=),)
bits := $(shell getconf LONG_BIT)
ifeq ($(bits),64)
platform?=linuxArm64
else
platform?=linuxArm32Hfp
endif
else ifeq ($(uname_m:aarch%=),)
bits := $(shell getconf LONG_BIT)
ifeq ($(bits),64)
platform?=linuxArm64
else
platform?=linuxArm32Hfp
endif
else ifndef platform
$(error Unsupported platform $(uname_m))
endif
BUILD_DIR=build/bin/$(platform)/releaseShared
SOURCES=$(wildcard src/*/kotlin/org/decsync/library/*.kt)
PC_PREFIX:=prefix=$(prefix)
.PHONY: all
all: $(BUILD_DIR)/libdecsync_api.h $(BUILD_DIR)/libdecsync.so $(BUILD_DIR)/decsync.pc
$(BUILD_DIR)/libdecsync_api.h $(BUILD_DIR)/libdecsync.so: $(SOURCES)
./gradlew linkReleaseShared$(platform)
$(BUILD_DIR)/decsync.pc: src/linuxMain/decsync.pc.in
$(file > $(BUILD_DIR)/decsync.pc,$(PC_PREFIX))
cat src/linuxMain/decsync.pc.in >> $(BUILD_DIR)/decsync.pc
.PHONY: install
install: $(BUILD_DIR)/libdecsync_api.h $(BUILD_DIR)/libdecsync.so $(BUILD_DIR)/decsync.pc
$(INSTALL) -d $(DESTDIR)$(prefix)/include
$(INSTALL) -m 644 $(BUILD_DIR)/libdecsync_api.h $(DESTDIR)$(prefix)/include
$(INSTALL) -m 644 src/linuxMain/libdecsync.h $(DESTDIR)$(prefix)/include
$(INSTALL) -d $(DESTDIR)$(prefix)/lib
$(INSTALL) -m 644 $(BUILD_DIR)/libdecsync.so $(DESTDIR)$(prefix)/lib
$(INSTALL) -d $(DESTDIR)$(prefix)/share/pkgconfig
$(INSTALL) -m 644 $(BUILD_DIR)/decsync.pc $(DESTDIR)$(prefix)/share/pkgconfig
.PHONY: uninstall
uninstall:
$(RM) $(DESTDIR)$(prefix)/include/libdecsync_api.h
$(RM) $(DESTDIR)$(prefix)/include/libdecsync.h
$(RM) $(DESTDIR)$(prefix)/lib/libdecsync.so
$(RM) $(DESTDIR)$(prefix)/share/pkgconfig/decsync.pc
.PHONY: clean
clean:
./gradlew clean