You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2012/12/23 23:00:11 UTC

[lucy-commits] [6/7] git commit: refs/heads/c-bindings-wip1 - Add configure script for cfc

Add configure script for cfc


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/76d7bab6
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/76d7bab6
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/76d7bab6

Branch: refs/heads/c-bindings-wip1
Commit: 76d7bab6ff7314d96e987b1db3fc10e995395711
Parents: b9b16b0
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Dec 22 20:42:58 2012 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun Dec 23 03:32:53 2012 +0100

----------------------------------------------------------------------
 c/Makefile                     |    1 +
 clownfish/compiler/c/Makefile  |   28 +++++++-------------
 clownfish/compiler/c/configure |   47 +++++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/76d7bab6/c/Makefile
----------------------------------------------------------------------
diff --git a/c/Makefile b/c/Makefile
index 8ea9b7e..e8da574 100644
--- a/c/Makefile
+++ b/c/Makefile
@@ -390,6 +390,7 @@ $(LUCY_JSON_PARSER).c $(LUCY_JSON_PARSER).h: $(LEMON) $(LUCY_JSON_PARSER).y
 	$(LEMON) -q $(LUCY_JSON_PARSER).y
 
 $(CFC) :
+	(cd $(CFC_DIR) && ./configure)
 	make -C $(CFC_DIR)
 
 $(LUCY_AUTOGEN_DIR) : $(CFC)

http://git-wip-us.apache.org/repos/asf/lucy/blob/76d7bab6/clownfish/compiler/c/Makefile
----------------------------------------------------------------------
diff --git a/clownfish/compiler/c/Makefile b/clownfish/compiler/c/Makefile
index efd7332..242af0f 100644
--- a/clownfish/compiler/c/Makefile
+++ b/clownfish/compiler/c/Makefile
@@ -1,13 +1,8 @@
-CFC_COMMON_DIR = ../common
 CFC_INCLUDE_DIR = ../include
 CFC_SOURCE_DIR = ../src
 LEMON_DIR = ../../../lemon
 
-CFLAGS += -g -I. -I$(CFC_SOURCE_DIR) -I$(CFC_INCLUDE_DIR)
-
-CHARMONY_H = charmony.h
-CHARMONIZER = charmonizer
-CHARMONIZER_C = $(CFC_COMMON_DIR)/charmonizer.c
+CFLAGS = -g -I. -I$(CFC_SOURCE_DIR) -I$(CFC_INCLUDE_DIR)
 
 LEMON = $(LEMON_DIR)/lemon
 CFC_PARSE_HEADER = $(CFC_SOURCE_DIR)/CFCParseHeader
@@ -45,29 +40,26 @@ CFC_OBJS = \
 
 all : $(CFC)
 
-$(CHARMONIZER) : $(CHARMONIZER_C)
-	$(CC) $(CFLAGS) $(CHARMONIZER_C) -o $@
-
-$(CHARMONY_H) : $(CHARMONIZER)
-	./$(CHARMONIZER) --cc=$(CC) -- $(CFLAGS)
-
 $(LEMON) :
 	make -C $(LEMON_DIR)
 
-$(CFC_PARSE_HEADER).c $(CFC_PARSE_HEADER).h: $(LEMON) $(CFC_PARSE_HEADER).y
+$(CFC_PARSE_HEADER).c : $(CFC_PARSE_HEADER).h
+
+$(CFC_PARSE_HEADER).c $(CFC_PARSE_HEADER).h : $(LEMON) $(CFC_PARSE_HEADER).y
 	$(LEMON) -q $(CFC_PARSE_HEADER).y
 
-$(CFC_OBJS) : $(CHARMONY_H) $(CFC_PARSE_HEADER).h
+$(CFC_OBJS) : $(CFC_PARSE_HEADER).h
 
 $(CFC) : $(CFC_OBJS)
 	$(CC) $(LDFLAGS) $(CFC_OBJS) $(LOADLIBES) $(LDLIBS) -o $@
 
 clean :
-	rm -rf \
+	rm -f \
 	    $(CFC) \
 	    $(CFC_OBJS) \
 	    $(CFC_PARSE_HEADER).c \
-	    $(CFC_PARSE_HEADER).h \
-	    $(CHARMONY_H) \
-	    $(CHARMONIZER)
+	    $(CFC_PARSE_HEADER).h
+
+distclean : clean
+	rm -f charmonizer charmony.h
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/76d7bab6/clownfish/compiler/c/configure
----------------------------------------------------------------------
diff --git a/clownfish/compiler/c/configure b/clownfish/compiler/c/configure
new file mode 100755
index 0000000..d0fedc0
--- /dev/null
+++ b/clownfish/compiler/c/configure
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+probe_clang() { clang -v; }
+probe_gcc()   { gcc -v; }
+
+if [ -z "$CC" ]; then
+    case $(uname) in
+        Darwin*) compilers="clang gcc";;
+        *)       compilers="gcc clang";;
+    esac
+
+    for compiler in $compilers; do
+        if probe_$compiler >/dev/null 2>&1; then
+            CC=$compiler
+            break
+        fi
+    done
+
+    if [ -z "$CC" ]; then
+        CC=cc
+    fi
+fi
+
+echo "Using C compiler '$CC'"
+
+command="$CC ../common/charmonizer.c -o charmonizer"
+echo $command
+$command || exit
+
+echo Running charmonizer
+./charmonizer --cc=$CC $@
+