forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.linux.makefile
More file actions
52 lines (42 loc) · 1.53 KB
/
Copy pathapplication.linux.makefile
File metadata and controls
52 lines (42 loc) · 1.53 KB
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
###############################################################################
# Linux Application Makefile Template
# Make sure the environment makefile has been included.
ifeq ($(ARCH),)
$(error Environment Makefile not included!)
endif
TYPE_DEFINES=
TYPE_INCLUDES=
TYPE_CCFLAGS=
include $(shell pwd)/$(dir $(lastword $(MAKEFILE_LIST)))/common.linux.makefile
###############################################################################
# Customizations
LIBS=$(CUSTOM_LIBS)
SHARED_LIBS=$(CUSTOM_SHARED_LIBS)
STATIC_LIBS=$(CUSTOM_STATIC_LIBS)
DYNAMIC_LIBS=$(CUSTOM_DYNAMIC_LIBS)
ifeq ($(ARCH),x86_64)
DYNAMIC_LIBS+=stdc++
else
STATIC_LIBS+=stdc++
endif
LDFLAGS=$(CUSTOM_LDFLAGS) $(addprefix -L,$(GLOBAL_LIBS)) -Xlinker -no-undefined $(addprefix -Xlinker --exclude-libs -Xlinker ,$(addsuffix .a,$(addprefix lib,$(STATIC_LIBS))))
TARGET_PATH=$(BUILD_DIR)/$(NAME)
$(TARGET_PATH): $(OBJECTS) $(DEPS)
mkdir -p $(dir $(TARGET_PATH))
$(CC) -fvisibility=hidden -o$(TARGET_PATH) $(LDFLAGS) $(OBJECTS) $(CUSTOM_OBJECTS) \
-Wl,-Bstatic \
-Wl,--start-group \
$(addsuffix .a,$(addprefix $(PRODUCT_DIR)/lib,$(LIBS))) \
$(addprefix -l,$(STATIC_LIBS)) \
-Wl,--end-group \
-Wl,-Bdynamic \
$(addsuffix .so,$(addprefix $(PRODUCT_DIR)/,$(SHARED_LIBS))) \
$(addprefix -l,$(DYNAMIC_LIBS))
ifneq ($(MODE),debug)
cd $(BUILD_DIR) && \
objcopy --only-keep-debug "$(NAME)" "$(NAME).dbg" && \
strip --strip-debug --strip-unneeded "$(NAME)" && \
objcopy --add-gnu-debuglink="$(NAME).dbg" "$(NAME)"
endif
.PHONY: $(NAME)
$(NAME): $(TARGET_PATH)