nitc: rename `c_compiler_option` and cie to `cflags` and `ldflags`
authorAlexis Laferrière <alexis.laf@xymus.net>
Sat, 24 Jan 2015 14:17:45 +0000 (09:17 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Sat, 24 Jan 2015 14:17:45 +0000 (09:17 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/compiler/compiler_ffi.nit
src/ffi/c.nit
src/ffi/c_compiler_options.nit
src/ffi/cpp.nit
src/ffi/ffi.nit
src/ffi/java.nit
src/ffi/objc.nit
src/frontend/check_annotation.nit

index 8466af1..ac7bad3 100644 (file)
@@ -52,7 +52,7 @@ extern void nitni_global_ref_decr(void*);
                nitni_ccu.write_as_nitni(self, v.compiler.modelbuilder.compile_dir)
 
                for file in nitni_ccu.files do
-                       var f = new ExternCFile(file, c_compiler_options)
+                       var f = new ExternCFile(file, cflags)
                        f.pkgconfigs.add_all pkgconfigs
                        v.compiler.extern_bodies.add(f)
                end
@@ -76,7 +76,7 @@ extern void nitni_global_ref_decr(void*);
 
        redef fun collect_linker_libs
        do
-               var s = c_linker_options
+               var s = ldflags
                if s.is_empty then return null
                var res = new ArraySet[String]
                res.add s
index 8ae08b9..ebd2277 100644 (file)
@@ -72,8 +72,8 @@ redef class Location
 end
 
 redef class MModule
-       var c_compiler_options = "" is writable
-       var c_linker_options = "" is writable
+       var cflags = "" is writable
+       var ldflags = "" is writable
 
        # Additional libraries needed for the compilation
        # Will be used with pkg-config
index af4e938..e4756a8 100644 (file)
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Offers the annotations `c_compiler_option` and `c_linker_option` to specify
+# Offers the annotations `cflags` and `ldflags` to specify
 # options for the C compiler directly or indirectly. Differs from the `pkgconfig`
 # annotation by the separation of the options between the compiler and linker.
 module c_compiler_options
@@ -24,15 +24,15 @@ import cpp
 private import annotation
 
 redef class ToolContext
-       var c_compiler_options_phase: Phase = new CCompilerOptionsPhase(self, null)
+       var cflags_phase: Phase = new CCompilerOptionsPhase(self, null)
 end
 
 private class CCompilerOptionsPhase
        super Phase
 
-       fun compiler_annotation_name: String do return "c_compiler_option"
-       fun linker_annotation_name: String do return "c_linker_option"
-       fun cpp_compiler_annotation_name: String do return "cpp_compiler_option"
+       fun compiler_annotation_name: String do return "cflags"
+       fun linker_annotation_name: String do return "ldflags"
+       fun cpp_compiler_annotation_name: String do return "cppflags"
 
        redef fun process_annotated_node(nmoduledecl, nat)
        do
@@ -145,17 +145,17 @@ private class CCompilerOptionsPhase
 
        fun process_c_compiler_annotation(mmodule: MModule, opt: String)
        do
-               mmodule.c_compiler_options = "{mmodule.c_compiler_options} {opt}"
+               mmodule.cflags = "{mmodule.cflags} {opt}"
        end
 
        fun process_c_linker_annotation(mmodule: MModule, opt: String)
        do
-               mmodule.c_linker_options = "{mmodule.c_linker_options} {opt}"
+               mmodule.ldflags = "{mmodule.ldflags} {opt}"
        end
 
        fun process_cpp_compiler_annotation(mmodule: MModule, opt: String)
        do
-               mmodule.cpp_compiler_options = "{mmodule.cpp_compiler_options} {opt}"
+               mmodule.cppflags = "{mmodule.cppflags} {opt}"
        end
 end
 
index a6a8ca3..e114cd2 100644 (file)
@@ -27,7 +27,7 @@ end
 redef class MModule
        private var cpp_file: nullable CPPCompilationUnit = null
 
-       var cpp_compiler_options = "" is writable
+       var cppflags = "" is writable
 end
 
 class CPPLanguage
@@ -133,7 +133,7 @@ class CPPLanguage
                mmodule.ffi_files.add(file)
 
                # add linked option to support C++
-               mmodule.c_linker_options = "{mmodule.c_linker_options} -lstdc++"
+               mmodule.ldflags = "{mmodule.ldflags} -lstdc++"
        end
 
        redef fun compile_callback(callback, mmodule, mainmodule, ecc)
@@ -180,7 +180,7 @@ class ExternCppFile
        var mmodule: MModule
 
        redef fun makefile_rule_name do return "{filename.basename("")}.o"
-       redef fun makefile_rule_content do return "$(CXX) $(CFLAGS) {mmodule.cpp_compiler_options} -c {filename.basename("")} -o {filename.basename("")}.o"
+       redef fun makefile_rule_content do return "$(CXX) $(CFLAGS) {mmodule.cppflags} -c {filename.basename("")} -o {filename.basename("")}.o"
        redef fun compiles_to_o_file do return true
 end
 
index b854750..cccb7a0 100644 (file)
@@ -62,7 +62,7 @@ redef class MModule
 
                ffi_ccu.write_as_impl(self, compdir)
                for filename in ffi_ccu.files do
-                       var f = new ExternCFile(filename, c_compiler_options)
+                       var f = new ExternCFile(filename, cflags)
                        f.pkgconfigs.add_all pkgconfigs
                        ffi_files.add(f)
                end
index 1fa56e9..77c3c56 100644 (file)
@@ -242,8 +242,8 @@ redef class MModule
        # Tell the C compiler where to find jni.h and how to link with libjvm
        private fun insert_compiler_options
        do
-               c_compiler_options = "{c_compiler_options} -I $(JAVA_HOME)/include/ -I $(JAVA_HOME)/include/linux/"
-               c_linker_options = "{c_linker_options} -L $(JNI_LIB_PATH) -ljvm"
+               cflags = "{cflags} -I $(JAVA_HOME)/include/ -I $(JAVA_HOME)/include/linux/"
+               ldflags = "{ldflags} -L $(JNI_LIB_PATH) -ljvm"
        end
 
        # Name of the generated Java class where to store all implementation methods of this module
index f031289..7e309bc 100644 (file)
@@ -154,7 +154,7 @@ private class ObjCCompilationUnit
 
                files.add compdir/c_file
 
-               mmodule.c_linker_options = "{mmodule.c_linker_options} -lobjc"
+               mmodule.ldflags = "{mmodule.ldflags} -lobjc"
 
                return new ExternObjCFile(compdir/c_file, mmodule)
        end
index fa909bc..a51bece 100644 (file)
@@ -92,8 +92,8 @@ extern
 no_warning
 
 pkgconfig
-c_compiler_option
-c_linker_option
+cflags
+ldflags
 
 platform
 """