Skip to content

Commit aedf58c

Browse files
committed
Updated makefile
1 parent f51d8fb commit aedf58c

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

Makefile

+27-28
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
1-
#
2-
# Makefile
3-
# swift-create-xcframework
4-
#
5-
# Created by Rob Amos on 7/5/20.
6-
#
1+
SHELL = /bin/bash
72

8-
PRODUCT := swift-create-xcframework
9-
INSTALL_DIR := /usr/local/bin
3+
prefix ?= /usr/local
4+
bindir ?= $(prefix)/bin
5+
libdir ?= $(prefix)/lib
6+
srcdir = Sources
107

11-
# Override this on the command line if you need to
12-
BUILD_FLAGS :=
8+
REPODIR = $(shell pwd)
9+
BUILDDIR = $(REPODIR)/.build
10+
SOURCES = $(wildcard $(srcdir)/**/*.swift)
1311

14-
.PHONY: build build-release install install-debug
12+
.DEFAULT_GOAL = all
1513

16-
default: build
17-
build: build-debug
14+
swift-create-xcframework: $(SOURCES)
15+
@swift build \
16+
-c release \
17+
--disable-sandbox \
18+
--build-path "$(BUILDDIR)"
1819

19-
# Release Builds
20+
.PHONY: install
21+
install: swift-create-xcframework
22+
@install -d "$(bindir)"
23+
@install "$(wildcard $(BUILDDIR)/**/release/swift-create-xcframework)" "$(bindir)"
2024

21-
build-release: $(wildcard Sources/*/*.swift)
22-
swift build $(BUILD_FLAGS) --configuration release
25+
.PHONY: uninstall
26+
uninstall:
27+
@rm -rf "$(bindir)/swift-create-xcframework"
2328

24-
install: build-release
25-
cp .build/release/swift-create-xcframework $(INSTALL_DIR)/$(PRODUCT)
26-
touch -c $(INSTALL_DIR)/$(PRODUCT)
27-
28-
# Debug builds
29-
30-
build-debug: $(wildcard Sources/*/*.swift)
31-
swift build $(BUILD_FLAGS) --configuration debug
32-
33-
install-debug: build-debug
34-
cp .build/debug/swift-create-xcframework $(INSTALL_DIR)/$(PRODUCT)
35-
touch -c $(INSTALL_DIR)/$(PRODUCT)
29+
.PHONY: clean
30+
distclean:
31+
@rm -f $(BUILDDIR)/release
3632

33+
.PHONY: clean
34+
clean: distclean
35+
@rm -rf $(BUILDDIR)

0 commit comments

Comments
 (0)