cinvoke-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cinvoke-svn] r96 - in trunk/cinvoke: . bindings bindings/java bindings/


From: will
Subject: [cinvoke-svn] r96 - in trunk/cinvoke: . bindings bindings/java bindings/lua lib test
Date: 15 Jul 2006 16:09:05 -0400

Author: will
Date: 2006-07-15 16:09:05 -0400 (Sat, 15 Jul 2006)
New Revision: 96

Added:
   trunk/cinvoke/bindings/ruby/
Modified:
   trunk/cinvoke/Makefile.templ
   trunk/cinvoke/bindings/java/Makefile.templ
   trunk/cinvoke/bindings/lua/Makefile.templ
   trunk/cinvoke/configure.pl
   trunk/cinvoke/lib/Makefile.templ
   trunk/cinvoke/test/Makefile.templ
Log:
rationalized template system


Modified: trunk/cinvoke/Makefile.templ
===================================================================
--- trunk/cinvoke/Makefile.templ        2006-07-15 18:45:44 UTC (rev 95)
+++ trunk/cinvoke/Makefile.templ        2006-07-15 20:09:05 UTC (rev 96)
@@ -1,17 +1,19 @@
 all:
-       cd lib && \$(MAKE)
-       cd test && \$(MAKE)
-       cp -f lib/arch/$ARCH_HEADER lib/cinvoke-archspec.h
+       cd lib && $(MAKE)
+       cd test && $(MAKE)
+       cp -f lib/arch/[ARCH_HEADER] lib/cinvoke-archspec.h
 
 install:
-       install -d $PREFIX/include
-       install -d $PREFIX/lib
-       install lib/cinvoke.h lib/cinvoke-arch.h lib/cinvoke-archspec.h 
$PREFIX/include
-       install lib/libcinvoke.a $PREFIX/lib
+       install -d [PREFIX]/include
+       install -d [PREFIX]/lib
+       install lib/cinvoke.h lib/cinvoke-arch.h lib/cinvoke-archspec.h \
+               [PREFIX]/include
+       install lib/libcinvoke.a [PREFIX]/lib
 
 uninstall:
-       rm -f $PREFIX/include/cinvoke.h $PREFIX/include/cinvoke-arch.h 
$PREFIX/include/cinvoke-archspec.h $PREFIX/lib/libcinvoke.a
+       rm -f [PREFIX]/include/cinvoke.h [PREFIX]/include/cinvoke-arch.h \
+               [PREFIX]/include/cinvoke-archspec.h [PREFIX]/lib/libcinvoke.a
 
 clean:
-       cd lib && \$(MAKE) clean
-       cd test && \$(MAKE) clean
+       cd lib && $(MAKE) clean
+       cd test && $(MAKE) clean

Modified: trunk/cinvoke/bindings/java/Makefile.templ
===================================================================
--- trunk/cinvoke/bindings/java/Makefile.templ  2006-07-15 18:45:44 UTC (rev 95)
+++ trunk/cinvoke/bindings/java/Makefile.templ  2006-07-15 20:09:05 UTC (rev 96)
@@ -1,16 +1,16 @@
-TARGET = libcinvoke_java.$JNIDYNEXT
+TARGET = libcinvoke_java.[JNIDYNEXT]
 
-all: \$(TARGET)
+all: $(TARGET)
        javac org/cinvoke/*.java
 
 SRC = org_cinvoke_Natives.cpp
-OBJ = \$(SRC:.cpp=.o)
+OBJ = $(SRC:.cpp=.o)
 
-\$(TARGET): \$(OBJ)
-       $CXXBUILDSHARED \$(TARGET) \$(OBJ) -L../../lib -lcinvoke
+$(TARGET): $(OBJ)
+       [CXXBUILDSHARED] $(TARGET) $(OBJ) -L../../lib -lcinvoke
 
-\$(OBJ): \$(SRC) org_cinvoke_Natives.h
-       g++ $CFLAGS $DYNCFLAGS -I../../lib $JNIINCLUDE -c \$(SRC) -o \$(OBJ)
+$(OBJ): $(SRC) org_cinvoke_Natives.h
+       g++ [CFLAGS] [DYNCFLAGS] -I../../lib [JNIINCLUDE] -c $(SRC) -o $(OBJ)
 
 header:
        javah org.cinvoke.Natives

Modified: trunk/cinvoke/bindings/lua/Makefile.templ
===================================================================
--- trunk/cinvoke/bindings/lua/Makefile.templ   2006-07-15 18:45:44 UTC (rev 95)
+++ trunk/cinvoke/bindings/lua/Makefile.templ   2006-07-15 20:09:05 UTC (rev 96)
@@ -1,20 +1,20 @@
-TARGET = cinvoke_lua.$DYNEXT
+TARGET = cinvoke_lua.[DYNEXT]
 
-all: \$(TARGET)
+all: $(TARGET)
 
 test:
        lua test.lua
 
 clean:
-       rm -f *.o \$(TARGET)
+       rm -f *.o $(TARGET)
 
 SRCS = cinvoke_lua.c
 
-OBJS = \$(SRCS:.c=.o)
+OBJS = $(SRCS:.c=.o)
 
-\$(TARGET): \$(OBJS)
-       $BUILDSHARED \$(TARGET) \$(OBJS) -L../../lib -llua -lcinvoke
+$(TARGET): $(OBJS)
+       [BUILDSHARED] $(TARGET) $(OBJS) -L../../lib -llua -lcinvoke
 
 .c.o:
-       gcc $CFLAGS $DYNCFLAGS -I../../lib -c \$< -o \$\@
+       gcc [CFLAGS] [DYNCFLAGS] -I../../lib -c $< -o $@
 

Modified: trunk/cinvoke/configure.pl
===================================================================
--- trunk/cinvoke/configure.pl  2006-07-15 18:45:44 UTC (rev 95)
+++ trunk/cinvoke/configure.pl  2006-07-15 20:09:05 UTC (rev 96)
@@ -5,23 +5,10 @@
 my $PREFIX = '/usr/local';
 my @TARGETS = qw(Makefile lib/Makefile test/Makefile bindings/lua/Makefile 
bindings/java/Makefile);
 
-foreach my $arg (@ARGV) {
-       if ($arg eq "--distclean") {
-               my $targets = join(" ", @TARGETS);
-               system("rm -f $targets");
-               exit;
-       } elsif ($arg =~ m/^--prefix=/) {
-               $PREFIX = substr($arg, 9);
-       } else {
-               print <<EOF;
-usage: configure.pl [--prefix=<path>]
-       configure.pl --distclean
-EOF
-               exit;
-       }
-}
+parse_args();
 
 my $platform = determine_platform();
+print "Using platform '$platform'\n";
 
 my $BUILDARCH = '-DARCH_GCC_' . $platform;
 my $CFLAGS = "-g -Wall -Werror -DCINVOKE_BUILD $BUILDARCH";
@@ -73,11 +60,13 @@
 }
 
 print "Complete.\n";
+exit;
 
 sub determine_platform {
        my $processor;
        
        my $gccout = `gcc -dumpmachine`;
+       if ($? != 0) { die "error executing gcc -dumpmachine: $!"; }
        if ($gccout =~ m/i386/) {
                $processor = 'X86';
        } elsif ($gccout =~ m/x86_64/) {
@@ -91,6 +80,7 @@
        my $os;
 
        my $uname = `uname`;
+       if ($? != 0) { die "error executing uname: $!"; }
        if ($uname =~ m/Darwin/) {
                $os = "OSX";
        } else {
@@ -110,9 +100,31 @@
        my $output = new IO::File(">$ofn") or die "cannot open $ofn: $!";
 
        while (<$input>) {
+               $_ =~ s/\\/\\\\/g;
                $_ =~ s/"/\\"/g;
+               $_ =~ s/\$/\\\$/g;
+               $_ =~ s/\@/\\\@/g;
+               $_ =~ s/\[([A-Za-z_][A-Za-z_0-9]*)\]/\$$1/g;
                eval("print \$output \"$_\"");
        }
        $input->close();
        $output->close();
 }
+
+sub parse_args {
+       foreach my $arg (@ARGV) {
+               if ($arg eq "--distclean") {
+                       my $targets = join(" ", @TARGETS);
+                       system("rm -f $targets");
+                       exit;
+               } elsif ($arg =~ m/^--prefix=/) {
+                       $PREFIX = substr($arg, 9);
+               } else {
+                       print <<EOF;
+usage: configure.pl [--prefix=<path>]
+       configure.pl --distclean
+EOF
+                       exit;
+               }
+       }
+}

Modified: trunk/cinvoke/lib/Makefile.templ
===================================================================
--- trunk/cinvoke/lib/Makefile.templ    2006-07-15 18:45:44 UTC (rev 95)
+++ trunk/cinvoke/lib/Makefile.templ    2006-07-15 20:09:05 UTC (rev 96)
@@ -1,26 +1,26 @@
 TARGET = libcinvoke.a
 
-all: \$(TARGET)
+all: $(TARGET)
 
 clean:
        rm -f *.o arch/*.o libcinvoke.a
 
-SRCS = cinvoke.c structure.c hashtable.c arch/$ARCH_SOURCE
+SRCS = cinvoke.c structure.c hashtable.c arch/[ARCH_SOURCE]
 
-OBJS = \$(SRCS:.c=.o)
+OBJS = $(SRCS:.c=.o)
 
-\$(TARGET): \$(OBJS)
-       $BUILDSTATIC \$(TARGET) \$(OBJS)
-       $RANLIB \$(TARGET)
+$(TARGET): $(OBJS)
+       [BUILDSTATIC] $(TARGET) $(OBJS)
+       [RANLIB] $(TARGET)
 
 .c.o:
-       gcc $CFLAGS -c \$< -o \$\@
+       gcc [CFLAGS] -c $< -o $@
 
-cinvoke.o: cinvoke.c cinvoke.h cinvoke-arch.h arch/$ARCH_HEADER \\
+cinvoke.o: cinvoke.c cinvoke.h cinvoke-arch.h arch/[ARCH_HEADER] \
   cinvoke-private.h hashtable.h
-structure.o: structure.c cinvoke.h cinvoke-arch.h arch/$ARCH_HEADER \\
+structure.o: structure.c cinvoke.h cinvoke-arch.h arch/[ARCH_HEADER] \
   cinvoke-private.h hashtable.h
 hashtable.o: hashtable.c hashtable.h
-arch/$ARCH_OBJ: arch/$ARCH_HEADER arch/../cinvoke.h \\
-  arch/../cinvoke-arch.h \\
+arch/[ARCH_OBJ]: arch/[ARCH_HEADER] arch/../cinvoke.h \
+  arch/../cinvoke-arch.h \
   arch/../cinvoke-private.h arch/../hashtable.h

Modified: trunk/cinvoke/test/Makefile.templ
===================================================================
--- trunk/cinvoke/test/Makefile.templ   2006-07-15 18:45:44 UTC (rev 95)
+++ trunk/cinvoke/test/Makefile.templ   2006-07-15 20:09:05 UTC (rev 96)
@@ -1,15 +1,15 @@
-SHARED = lib.$DYNEXT
+SHARED = lib.[DYNEXT]
 
-all: \$(SHARED) runtests
+all: $(SHARED) runtests
 
 clean:
-       rm -f lib.o \$(SHARED) runtests
+       rm -f lib.o $(SHARED) runtests
 
 lib.o: lib.c
-       gcc -g -c $DYNCFLAGS lib.c -o lib.o -Wall -Werror
+       gcc -g -c [DYNCFLAGS] lib.c -o lib.o -Wall -Werror
 
-\$(SHARED): lib.o
-       $BUILDSHARED \$(SHARED) lib.o
+$(SHARED): lib.o
+       [BUILDSHARED] $(SHARED) lib.o
 
-runtests: runtests.c \$(SHARED) ../lib/libcinvoke.a
-       gcc $CFLAGS -o runtests runtests.c -L../lib -I../lib $LIBDL -lcinvoke 
-lm
+runtests: runtests.c $(SHARED) ../lib/libcinvoke.a
+       gcc [CFLAGS] -o runtests runtests.c -L../lib -I../lib [LIBDL] -lcinvoke 
-lm





reply via email to

[Prev in Thread] Current Thread [Next in Thread]