浏览代码

replace compile.sh with hugh-make

Simon Krajewski 8 年之前
父节点
当前提交
4621231b63
共有 2 个文件被更改,包括 19 次插入13 次删除
  1. 19 5
      Makefile
  2. 0 8
      compile.sh

+ 19 - 5
Makefile

@@ -57,6 +57,10 @@ CC_CMD = $(COMPILER) $(ALL_CFLAGS) -c $<
 
 # Meta information
 
+BUILD_DIRECTORIES := $(HAXE_DIRECTORIES:%=_build/src/%)
+HAXE_SRC := $(wildcard $(HAXE_DIRECTORIES:%=src/%/*.ml))
+BUILD_SRC := $(HAXE_SRC:%=_build/%)
+
 ADD_REVISION?=0
 
 BRANCH=$(shell echo $$APPVEYOR_REPO_NAME | grep -q /haxe && echo $$APPVEYOR_REPO_BRANCH || echo $$TRAVIS_REPO_SLUG | grep -q /haxe && echo $$TRAVIS_BRANCH || git rev-parse --abbrev-ref HEAD)
@@ -99,15 +103,25 @@ all: libs haxe tools
 libs:
 	$(foreach lib,$(EXTLIB_LIBS),$(MAKE) -C libs/$(lib) $(TARGET_FLAG) &&) true
 
-copy_output_files:
-	mkdir -p _build
-	$(foreach dir,$(HAXE_DIRECTORIES:%=src/%),mkdir -p _build/$(dir) && rsync -u $(dir)/*.ml _build/$(dir) &&) true
-	sh compile.sh $(ADD_REVISION)
+_build/%:%
+	cp $< $@
+
+build_dirs:
+	@mkdir -p $(BUILD_DIRECTORIES)
+
+_build/src/syntax/parser.ml:src/syntax/parser.mly
+	camlp4o -impl $< -o $@
+
+_build/src/compiler/version.ml:
 ifneq ($(ADD_REVISION),0)
 	$(MAKE) -f Makefile.version_extra -s --no-print-directory ADD_REVISION=$(ADD_REVISION) BRANCH=$(BRANCH) COMMIT_SHA=$(COMMIT_SHA) COMMIT_DATE=$(COMMIT_DATE) > _build/src/compiler/version.ml
+else
+	echo let version_extra = None > _build/src/compiler/version.ml
 endif
 
-haxe: copy_output_files
+build_src:build_dirs $(BUILD_SRC) _build/src/syntax/parser.ml _build/src/compiler/version.ml
+
+haxe: build_src
 	$(MAKE) -f $(MAKEFILENAME) build_pass_1
 	$(MAKE) -f $(MAKEFILENAME) build_pass_2
 	$(MAKE) -f $(MAKEFILENAME) build_pass_3

+ 0 - 8
compile.sh

@@ -1,8 +0,0 @@
-#!/bin/sh
-if [ ! -f "_build/src/syntax/parser.ml" -o "src/syntax/parser.mly" -nt "_build/src/syntax/parser.ml" ]; then
-	camlp4o -impl src/syntax/parser.mly -o _build/src/syntax/parser.ml
-fi
-
-if [ "$1" -eq "0" -a ! -f "_build/src/compiler/version.ml" ]; then
-	echo let version_extra = None > _build/src/compiler/version.ml
-fi