Use Makefile to simplify CMake configuration
authorJonghyun Park <jh1302.park@samsung.com>
Mon, 26 Feb 2018 03:52:39 +0000 (12:52 +0900)
committerJonghyun Park <jh1302.park@samsung.com>
Mon, 26 Feb 2018 04:18:01 +0000 (13:18 +0900)
This commit introduces Makefile to simplify CMake configurations.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
.gitignore
Makefile [new file with mode: 0644]

index 259148f..13a8431 100644 (file)
@@ -30,3 +30,6 @@
 *.exe
 *.out
 *.app
+
+# Working Path
+/Product
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..72467a1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,53 @@
+WORKDIR=Product
+
+BUILD_ROOT=$(WORKDIR)/obj
+INSTALL_ROOT?=$(WORKDIR)/out
+
+TIMESTAMP_CONFIGURE=$(WORKDIR)/CONFIGURE
+TIMESTAMP_BUILD=$(WORKDIR)/BUILD
+TIMESTAMP_INSTALL=$(WORKDIR)/INSTALL
+
+all: build
+
+###
+### Command (public)
+###
+configure: configure_internal
+
+build: build_internal
+
+install: $(TIMESTAMP_INSTALL)
+
+clean:
+       rm -rf $(WORKDIR)
+
+###
+### Command (internal)
+###
+configure_internal:
+       mkdir -p $(BUILD_ROOT)
+       cd $(BUILD_ROOT) && cmake $(CURDIR) -DCMAKE_INSTALL_PREFIX=$(INSTALL_ROOT)
+       touch $(TIMESTAMP_CONFIGURE)
+
+build_internal:
+       cd $(BUILD_ROOT) && make all
+       touch $(TIMESTAMP_BUILD)
+
+install_internal:
+       cd $(BUILD_ROOT) && make install
+       touch $(TIMESTAMP_INSTALL)
+
+###
+### Timestamps
+###
+$(WORKDIR):
+       mkdir -p $@
+
+$(TIMESTAMP_CONFIGURE):
+       make configure_internal
+
+$(TIMESTAMP_BUILD): $(TIMESTAMP_CONFIGURE)
+       make build_internal
+
+$(TIMESTAMP_INSTALL): $(TIMESTAMP_BUILD)
+       make install_internal