Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit fda187f

Browse files
author
livecodeali
committed
Move common makefile functionality into single file
1 parent d80e4ad commit fda187f

File tree

3 files changed

+69
-67
lines changed

3 files changed

+69
-67
lines changed

Makefile

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ IOS_SDKS ?= \
3434

3535
# Choose the correct build type
3636
MODE ?= debug
37-
ifeq ($(MODE),debug)
38-
export BUILDTYPE ?= Debug
39-
else ifeq ($(MODE),release)
40-
export BUILDTYPE ?= Release
41-
else ifeq ($(MODE),fast)
42-
export BUILDTYPE ?= Fast
43-
else
44-
$(error "Mode must be 'debug' or 'release'")
45-
endif
4637

4738
# Where to run the build command depends on community vs commercial
4839
ifeq ($(BUILD_EDITION),commercial)
@@ -53,17 +44,12 @@ else
5344
BUILD_PROJECT := livecode
5445
endif
5546

47+
include Makefile.common
48+
5649
################################################################
5750

5851
.DEFAULT: all
5952

60-
guess_platform_script := \
61-
case `uname -s` in \
62-
Linux) echo linux ;; \
63-
Darwin) echo mac ;; \
64-
esac
65-
guess_platform := $(shell $(guess_platform_script))
66-
6753
all: all-$(guess_platform)
6854
check: check-$(guess_platform)
6955

@@ -78,14 +64,6 @@ check-common-%:
7864

7965
LINUX_ARCHS = x86_64 x86
8066

81-
guess_linux_arch_script := \
82-
case `uname -p` in \
83-
x86_64) echo x86_64 ;; \
84-
x86|i*86) echo x86 ;; \
85-
esac
86-
87-
guess_linux_arch := $(shell $(guess_linux_arch_script))
88-
8967
config-linux-%:
9068
./config.sh --platform linux-$*
9169

Makefile.common

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright (C) 2016 LiveCode Ltd.
2+
#
3+
# This file is part of LiveCode.
4+
#
5+
# LiveCode is free software; you can redistribute it and/or modify it under
6+
# the terms of the GNU General Public License v3 as published by the Free
7+
# Software Foundation.
8+
#
9+
# LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
10+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
# for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with LiveCode. If not see <http://www.gnu.org/licenses/>.
16+
17+
# This file consists of some common functionality required by various
18+
# Makefiles
19+
20+
ifeq ($(MODE),debug)
21+
export BUILDTYPE ?= Debug
22+
else ifeq ($(MODE),release)
23+
export BUILDTYPE ?= Release
24+
else ifeq ($(MODE),fast)
25+
export BUILDTYPE ?= Fast
26+
else
27+
$(error "Mode must be 'debug' or 'release'")
28+
endif
29+
30+
################################################################
31+
# Attempt to guess where to find various tools and libraries
32+
################################################################
33+
34+
top_srcdir ?= .
35+
36+
guess_linux_arch_script := \
37+
case `uname -p` in \
38+
x86_64) echo x86_64 ;; \
39+
x86|i*86) echo x86 ;; \
40+
esac
41+
guess_linux_arch := $(shell $(guess_linux_arch_script))
42+
43+
guess_platform_script := \
44+
case `uname -s` in \
45+
Linux) echo linux-$(guess_linux_arch) ;; \
46+
Darwin) echo mac ;; \
47+
esac
48+
guess_platform := $(shell $(guess_platform_script))
49+
50+
guess_engine_flags_script := \
51+
if echo $(guess_platform) | grep "^linux" >/dev/null 2>&1 && \
52+
! xset -q >/dev/null 2>&1 ; then \
53+
echo "-ui"; \
54+
fi
55+
guess_engine_flags := $(shell $(guess_engine_flags_script))
56+
57+
ifeq ($(guess_platform),mac)
58+
bin_dir ?= $(top_srcdir)/_build/mac/$(BUILDTYPE)
59+
else
60+
bin_dir ?= $(top_srcdir)/$(guess_platform)-bin
61+
endif
62+
63+
guess_engine := $(if $(filter mac,$(guess_platform)),$(bin_dir)/Standalone-Community.app/Contents/MacOS/Standalone-Community,$(bin_dir)/standalone-community)
64+
guess_dev_engine := $(if $(filter mac,$(guess_platform)),$(bin_dir)/LiveCode-Community.app/Contents/MacOS/LiveCode-Community,$(bin_dir)/LiveCode-Community)

tests/Makefile

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,17 @@ else
44
_PRINT_RULE ?=
55
endif
66

7-
################################################################
8-
# Attempt to guess where to find various tools and libraries
9-
################################################################
10-
117
MODE ?= release
12-
ifeq ($(MODE),release)
13-
UC_MODE := Release
14-
else ifeq ($(MODE),debug)
15-
UC_MODE := Debug
16-
else ifeq ($(MODE),fast)
17-
UC_MODE := Fast
18-
else
19-
$(error "Mode must be 'debug' or 'release'")
20-
endif
21-
228
top_srcdir ?= ..
23-
TEST_DIR ?= $(top_srcdir)/_tests
24-
LCM_DIR ?= $(TEST_DIR)/_build
259

26-
guess_linux_arch_script := \
27-
case `uname -p` in \
28-
x86_64) echo x86_64 ;; \
29-
x86|i*86) echo x86 ;; \
30-
esac
31-
guess_linux_arch := $(shell $(guess_linux_arch_script))
32-
33-
guess_platform_script := \
34-
case `uname -s` in \
35-
Linux) echo linux-$(guess_linux_arch) ;; \
36-
Darwin) echo mac ;; \
37-
esac
38-
guess_platform := $(shell $(guess_platform_script))
39-
40-
ifeq ($(guess_platform),mac)
41-
bin_dir ?= $(top_srcdir)/_build/mac/$(UC_MODE)
42-
else
43-
bin_dir ?= $(top_srcdir)/$(guess_platform)-bin
44-
endif
10+
include $(top_srcdir)/Makefile.common
4511

4612
########## LiveCode Script test parameters
4713

48-
guess_engine := $(if $(filter mac,$(guess_platform)),$(bin_dir)/Standalone-Community.app/Contents/MacOS/Standalone-Community,$(bin_dir)/standalone-community)
49-
guess_dev_engine := $(if $(filter mac,$(guess_platform)),$(bin_dir)/LiveCode-Community.app/Contents/MacOS/LiveCode-Community,$(bin_dir)/LiveCode-Community)
14+
TEST_DIR ?= $(top_srcdir)/_tests
15+
LCM_DIR ?= $(TEST_DIR)/_build
5016

5117
# When running on headless Linux, run tests in -ui mode.
52-
guess_engine_flags_script := \
53-
if echo $(guess_platform) | grep "^linux" >/dev/null 2>&1 && \
54-
! xset -q >/dev/null 2>&1 ; then \
55-
echo "-ui"; \
56-
fi
57-
guess_engine_flags := $(shell $(guess_engine_flags_script))
5818

5919
LCS_ENGINE ?= $(guess_engine)
6020
LCS_ENGINE_FLAGS ?= $(guess_engine_flags)

0 commit comments

Comments
 (0)