cinvoke-svn
[Top][All Lists]
Advanced

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

[cinvoke-svn] r92 - in trunk/cinvoke: . bindings/java bindings/lua lib t


From: will
Subject: [cinvoke-svn] r92 - in trunk/cinvoke: . bindings/java bindings/lua lib test
Date: 14 Jul 2006 23:38:41 -0400

Author: will
Date: 2006-07-14 23:38:35 -0400 (Fri, 14 Jul 2006)
New Revision: 92

Added:
   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
Removed:
   trunk/cinvoke/Makefile.ppc
   trunk/cinvoke/Makefile.x64
   trunk/cinvoke/Makefile.x86
   trunk/cinvoke/bindings/java/Makefile
   trunk/cinvoke/bindings/lua/Makefile
   trunk/cinvoke/configure.sh
   trunk/cinvoke/lib/Makefile.ppc
   trunk/cinvoke/lib/Makefile.x64
   trunk/cinvoke/lib/Makefile.x86
   trunk/cinvoke/test/Makefile
   trunk/cinvoke/tools/
Log:
yet another new build system


Deleted: trunk/cinvoke/Makefile.ppc
===================================================================
--- trunk/cinvoke/Makefile.ppc  2006-07-13 06:27:42 UTC (rev 91)
+++ trunk/cinvoke/Makefile.ppc  2006-07-15 03:38:35 UTC (rev 92)
@@ -1,16 +0,0 @@
-PREFIX = /usr/local
-
-all:
-       cd lib && $(MAKE) BUILDARCH=-DARCH_GCC_PPC_OSX
-       cd test && $(MAKE) BUILDARCH=-DARCH_GCC_PPC_OSX DYNEXT=dylib
-       cp -f lib/arch/gcc_ppc_osx.h 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
-
-clean:
-       cd lib && $(MAKE) clean
-       cd test && $(MAKE) clean

Added: trunk/cinvoke/Makefile.templ
===================================================================
--- trunk/cinvoke/Makefile.templ                                (rev 0)
+++ trunk/cinvoke/Makefile.templ        2006-07-15 03:38:35 UTC (rev 92)
@@ -0,0 +1,17 @@
+all:
+       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
+
+uninstall:
+       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

Deleted: trunk/cinvoke/Makefile.x64
===================================================================
--- trunk/cinvoke/Makefile.x64  2006-07-13 06:27:42 UTC (rev 91)
+++ trunk/cinvoke/Makefile.x64  2006-07-15 03:38:35 UTC (rev 92)
@@ -1,19 +0,0 @@
-PREFIX = /usr/local
-
-all:
-       cd lib && $(MAKE) BUILDARCH=-DARCH_GCC_X64_UNIX
-       cd test && $(MAKE) BUILDARCH=-DARCH_GCC_X64_UNIX DYNEXT=so
-       cp -f lib/arch/gcc_x64_unix.h 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
-
-clean:
-       cd lib && $(MAKE) clean
-       cd test && $(MAKE) clean
-
-test:
-       cd test && $(MAKE) test

Deleted: trunk/cinvoke/Makefile.x86
===================================================================
--- trunk/cinvoke/Makefile.x86  2006-07-13 06:27:42 UTC (rev 91)
+++ trunk/cinvoke/Makefile.x86  2006-07-15 03:38:35 UTC (rev 92)
@@ -1,19 +0,0 @@
-PREFIX = /usr/local
-
-all:
-       cd lib && $(MAKE) BUILDARCH=-DARCH_GCC_X86_UNIX
-       cd test && $(MAKE) BUILDARCH=-DARCH_GCC_X86_UNIX DYNEXT=so
-       cp -f lib/arch/gcc_x86_unix.h 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
-
-clean:
-       cd lib && $(MAKE) clean
-       cd test && $(MAKE) clean
-
-test:
-       cd test && $(MAKE) test

Deleted: trunk/cinvoke/bindings/java/Makefile
===================================================================
--- trunk/cinvoke/bindings/java/Makefile        2006-07-13 06:27:42 UTC (rev 91)
+++ trunk/cinvoke/bindings/java/Makefile        2006-07-15 03:38:35 UTC (rev 92)
@@ -1,33 +0,0 @@
-TARGET = libcinvoke_java.so
-
-all: $(TARGET)
-       javac org/cinvoke/*.java
-
-SRCS = org_cinvoke_Natives.cpp
-OBJS = $(SRCS:.cpp=.o)
-
-$(TARGET): $(OBJS)
-       g++ -shared -o $(TARGET) $(OBJS) -lcinvoke
-
-.cpp.o:
-       g++ -Wall -Werror -c $<
-
-org_cinvoke_Natives.o: org_cinvoke_Natives.cpp org_cinvoke_Natives.h
-
-header:
-       javah org.cinvoke.Natives
-
-clean:
-       rm -f org/cinvoke/*.class *.class *.o *.so
-
-test:
-       javac Test.java
-       LD_LIBRARY_PATH=. java Test
-
-doc:
-       rm -rf javadoc
-       javadoc -d javadoc -windowtitle "C/Invoke Java Binding" 
org/cinvoke/*.java
-
-jar: all
-       jar -c -f cinvoke_java.jar org/cinvoke/*.class
-

Added: trunk/cinvoke/bindings/java/Makefile.templ
===================================================================
--- trunk/cinvoke/bindings/java/Makefile.templ                          (rev 0)
+++ trunk/cinvoke/bindings/java/Makefile.templ  2006-07-15 03:38:35 UTC (rev 92)
@@ -0,0 +1,33 @@
+TARGET = libcinvoke_java.$DYNEXT
+
+all: \$(TARGET)
+       javac org/cinvoke/*.java
+
+SRCS = org_cinvoke_Natives.cpp
+OBJS = \$(SRCS:.cpp=.o)
+
+\$(TARGET): \$(OBJS)
+       $CXXBUILDSHARED \$(TARGET) \$(OBJS) -L../../lib -lcinvoke
+
+.cpp.o:
+       g++ $CFLAGS $DYNCFLAGS -I../../lib -c \$< -o \$\@
+
+org_cinvoke_Natives.o: org_cinvoke_Natives.cpp org_cinvoke_Natives.h
+
+header:
+       javah org.cinvoke.Natives
+
+clean:
+       rm -f org/cinvoke/*.class *.class *.o *.so
+
+test:
+       javac Test.java
+       LD_LIBRARY_PATH=. java Test
+
+doc:
+       rm -rf javadoc
+       javadoc -d javadoc -windowtitle "C/Invoke Java Binding" 
org/cinvoke/*.java
+
+jar: all
+       jar -c -f cinvoke_java.jar org/cinvoke/*.class
+

Deleted: trunk/cinvoke/bindings/lua/Makefile
===================================================================
--- trunk/cinvoke/bindings/lua/Makefile 2006-07-13 06:27:42 UTC (rev 91)
+++ trunk/cinvoke/bindings/lua/Makefile 2006-07-15 03:38:35 UTC (rev 92)
@@ -1,20 +0,0 @@
-TARGET = cinvoke_lua.so
-
-all: $(TARGET)
-
-test:
-       lua test.lua
-
-clean:
-       rm -f *.o $(TARGET)
-
-SRCS = cinvoke_lua.c
-
-OBJS = $(SRCS:.c=.o)
-
-$(TARGET): $(OBJS)
-       gcc -shared -o $(TARGET) $(OBJS) -llua -lcinvoke
-
-.c.o:
-       gcc -g -Wall -Werror -c $< -o $@
-

Added: trunk/cinvoke/bindings/lua/Makefile.templ
===================================================================
--- trunk/cinvoke/bindings/lua/Makefile.templ                           (rev 0)
+++ trunk/cinvoke/bindings/lua/Makefile.templ   2006-07-15 03:38:35 UTC (rev 92)
@@ -0,0 +1,20 @@
+TARGET = cinvoke_lua.$DYNEXT
+
+all: \$(TARGET)
+
+test:
+       lua test.lua
+
+clean:
+       rm -f *.o \$(TARGET)
+
+SRCS = cinvoke_lua.c
+
+OBJS = \$(SRCS:.c=.o)
+
+\$(TARGET): \$(OBJS)
+       $BUILDSHARED \$(TARGET) \$(OBJS) -L../../lib -llua -lcinvoke
+
+.c.o:
+       gcc $CFLAGS $DYNCFLAGS -I../../lib -c \$< -o \$\@
+

Added: trunk/cinvoke/configure.pl
===================================================================
--- trunk/cinvoke/configure.pl                          (rev 0)
+++ trunk/cinvoke/configure.pl  2006-07-15 03:38:35 UTC (rev 92)
@@ -0,0 +1,111 @@
+#!/usr/bin/perl
+use IO::File;
+use strict;
+
+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
+       }
+}
+
+my $platform = determine_platform();
+
+my $BUILDARCH = '-DARCH_GCC_' . $platform;
+my $CFLAGS = "-g -Wall -Werror -DCINVOKE_BUILD $BUILDARCH";
+my $ARCH_HEADER = 'gcc_' . lc($platform) . '.h';
+my $DYNEXT;
+my $BUILDSHARED;
+my $CXXBUILDSHARED;
+my $BUILDSTATIC;
+my $RANLIB;
+my $DYNCFLAGS;
+my $LIBDL;
+
+# Linux and OSX have libdl, *BSD doesn't
+if ((-f '/lib/libdl.so.2') || $platform =~ m/_OSX$/) {
+       $LIBDL = '-ldl';
+} else {
+       $LIBDL = '';
+}
+# OSX build environment is all wonky
+if ($platform =~ m/_OSX$/) {
+       $DYNEXT = 'dylib';
+       $BUILDSHARED = 'libtool -dynamic -lc -o';
+       $CXXBUILDSHARED = 'libtool -dynamic -lc -o';
+       $BUILDSTATIC = 'libtool -static -o';
+       $RANLIB = 'echo';
+       $DYNCFLAGS = '-dynamic';
+} else {
+       $DYNEXT = 'so';
+       $BUILDSHARED = 'gcc -shared -o';
+       $CXXBUILDSHARED = 'g++ -shared -o';
+       $BUILDSTATIC = 'rm -f $(TARGET) && ar rs';
+       $RANLIB = 'ranlib';
+       $DYNCFLAGS = '-fPIC';
+}
+
+my $ARCH_SOURCE = $ARCH_HEADER;
+my $ARCH_OBJ = $ARCH_HEADER;
+$ARCH_SOURCE =~ s/\.h$/.c/;
+$ARCH_OBJ =~ s/\.h$/.o/;
+
+foreach my $target (@TARGETS) {
+       process($target);
+}
+
+print "Complete.\n";
+
+sub determine_platform {
+       my $processor;
+       
+       my $gccout = `gcc -dumpmachine`;
+       if ($gccout =~ m/i386/) {
+               $processor = 'X86';
+       } elsif ($gccout =~ m/amd64/) {
+               $processor = 'X64';
+       } elsif ($gccout =~ m/ppc/) {
+               $processor = 'PPC';
+       } else {
+               die "unrecognized architecture $gccout";
+       }
+
+       my $os;
+
+       my $uname = `uname`;
+       if ($uname =~ m/Darwin/) {
+               $os = "OSX";
+       } else {
+               $os = "UNIX"; # hey why not
+       }
+
+       return $processor . '_' . $os;
+}
+
+sub process {
+       my ($ofn) = @_;
+
+       print "Writing $ofn...\n";
+
+       my $fn = $ofn . ".templ";
+       my $input = new IO::File("<$fn") or die "cannot open $fn: $!";
+       my $output = new IO::File(">$ofn") or die "cannot open $ofn: $!";
+
+       while (<$input>) {
+               $_ =~ s/"/\\"/g;
+               eval("print \$output \"$_\"");
+       }
+       $input->close();
+       $output->close();
+}


Property changes on: trunk/cinvoke/configure.pl
___________________________________________________________________
Name: svn:executable
   + *

Deleted: trunk/cinvoke/configure.sh
===================================================================
--- trunk/cinvoke/configure.sh  2006-07-13 06:27:42 UTC (rev 91)
+++ trunk/cinvoke/configure.sh  2006-07-15 03:38:35 UTC (rev 92)
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-case "$1" in
-       'x86')
-               ln -s Makefile.x86 Makefile
-               cd lib ; ln -s Makefile.x86 Makefile
-               ;;
-       'x64')
-               ln -s Makefile.x64 Makefile
-               cd lib ; ln -s Makefile.x64 Makefile
-               ;;
-       'ppc')
-               ln -s Makefile.ppc Makefile
-               cd lib ; ln -s Makefile.ppc Makefile
-               ;;
-       'clean')
-               rm -f Makefile lib/Makefile
-               ;;
-       *)
-               echo "Usage: configure.sh <target>"
-               echo "Available targets are: x86 x64 ppc clean"
-               ;;
-esac

Deleted: trunk/cinvoke/lib/Makefile.ppc
===================================================================
--- trunk/cinvoke/lib/Makefile.ppc      2006-07-13 06:27:42 UTC (rev 91)
+++ trunk/cinvoke/lib/Makefile.ppc      2006-07-15 03:38:35 UTC (rev 92)
@@ -1,25 +0,0 @@
-TARGET = libcinvoke.a
-
-all: $(TARGET)
-
-clean:
-       rm -f *.o arch/*.o libcinvoke.a
-
-SRCS = cinvoke.c structure.c hashtable.c arch/gcc_ppc_osx.c
-
-OBJS = $(SRCS:.c=.o)
-
-$(TARGET): $(OBJS)
-       libtool -static -o $(TARGET) $(OBJS)
-
-.c.o:
-       gcc -g -Wall -Werror $(BUILDARCH) -DCINVOKE_BUILD -c $< -o $@
-
-cinvoke.o: cinvoke.c cinvoke.h cinvoke-arch.h arch/gcc_ppc_osx.h \
-  cinvoke-private.h hashtable.h
-structure.o: structure.c cinvoke.h cinvoke-arch.h arch/gcc_ppc_osx.h \
-  cinvoke-private.h hashtable.h
-hashtable.o: hashtable.c hashtable.h
-arch/gcc_ppc_osx.o: arch/gcc_ppc_osx.c arch/../cinvoke.h \
-  arch/../cinvoke-arch.h arch/../arch/gcc_ppc_osx.h \
-  arch/../cinvoke-private.h arch/../hashtable.h

Added: trunk/cinvoke/lib/Makefile.templ
===================================================================
--- trunk/cinvoke/lib/Makefile.templ                            (rev 0)
+++ trunk/cinvoke/lib/Makefile.templ    2006-07-15 03:38:35 UTC (rev 92)
@@ -0,0 +1,26 @@
+TARGET = libcinvoke.a
+
+all: \$(TARGET)
+
+clean:
+       rm -f *.o arch/*.o libcinvoke.a
+
+SRCS = cinvoke.c structure.c hashtable.c arch/$ARCH_SOURCE
+
+OBJS = \$(SRCS:.c=.o)
+
+\$(TARGET): \$(OBJS)
+       $BUILDSTATIC \$(TARGET) \$(OBJS)
+       $RANLIB \$(TARGET)
+
+.c.o:
+       gcc $CFLAGS -c \$< -o \$\@
+
+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 \\
+  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/../cinvoke-private.h arch/../hashtable.h

Deleted: trunk/cinvoke/lib/Makefile.x64
===================================================================
--- trunk/cinvoke/lib/Makefile.x64      2006-07-13 06:27:42 UTC (rev 91)
+++ trunk/cinvoke/lib/Makefile.x64      2006-07-15 03:38:35 UTC (rev 92)
@@ -1,27 +0,0 @@
-TARGET = libcinvoke.a
-
-all: $(TARGET)
-
-clean:
-       rm -f *.o arch/*.o libcinvoke.a
-
-SRCS = cinvoke.c structure.c hashtable.c arch/gcc_x64_unix.c
-
-OBJS = $(SRCS:.c=.o)
-
-$(TARGET): $(OBJS)
-       rm -f $(TARGET)
-       ar rs $(TARGET) $(OBJS)
-       ranlib $(TARGET)
-
-.c.o:
-       gcc -g -Wall -Werror $(BUILDARCH) -DCINVOKE_BUILD -c $< -o $@
-
-cinvoke.o: cinvoke.c cinvoke.h cinvoke-arch.h arch/gcc_x64_unix.h \
-  cinvoke-private.h hashtable.h
-structure.o: structure.c cinvoke.h cinvoke-arch.h arch/gcc_x64_unix.h \
-  cinvoke-private.h hashtable.h
-hashtable.o: hashtable.c hashtable.h
-arch/gcc_x64_unix.o: arch/gcc_x64_unix.c arch/../cinvoke.h \
-  arch/../cinvoke-arch.h arch/../arch/gcc_x64_unix.h \
-  arch/../cinvoke-private.h arch/../hashtable.h

Deleted: trunk/cinvoke/lib/Makefile.x86
===================================================================
--- trunk/cinvoke/lib/Makefile.x86      2006-07-13 06:27:42 UTC (rev 91)
+++ trunk/cinvoke/lib/Makefile.x86      2006-07-15 03:38:35 UTC (rev 92)
@@ -1,27 +0,0 @@
-TARGET = libcinvoke.a
-
-all: $(TARGET)
-
-clean:
-       rm -f *.o arch/*.o libcinvoke.a
-
-SRCS = cinvoke.c structure.c hashtable.c arch/gcc_x86_unix.c
-
-OBJS = $(SRCS:.c=.o)
-
-$(TARGET): $(OBJS)
-       rm -f $(TARGET)
-       ar rs $(TARGET) $(OBJS)
-       ranlib $(TARGET)
-
-.c.o:
-       gcc -g -Wall -Werror $(BUILDARCH) -DCINVOKE_BUILD -c $< -o $@
-
-cinvoke.o: cinvoke.c cinvoke.h cinvoke-arch.h arch/gcc_x86_unix.h \
-  cinvoke-private.h hashtable.h
-structure.o: structure.c cinvoke.h cinvoke-arch.h arch/gcc_x86_unix.h \
-  cinvoke-private.h hashtable.h
-hashtable.o: hashtable.c hashtable.h
-arch/gcc_x86_unix.o: arch/gcc_x86_unix.c arch/../cinvoke.h \
-  arch/../cinvoke-arch.h arch/../arch/gcc_x86_unix.h \
-  arch/../cinvoke-private.h arch/../hashtable.h

Deleted: trunk/cinvoke/test/Makefile
===================================================================
--- trunk/cinvoke/test/Makefile 2006-07-13 06:27:42 UTC (rev 91)
+++ trunk/cinvoke/test/Makefile 2006-07-15 03:38:35 UTC (rev 92)
@@ -1,15 +0,0 @@
-SHARED = lib.$(DYNEXT)
-
-all: $(SHARED) runtests
-
-clean:
-       rm -f lib.o $(SHARED) runtests
-
-lib.o: lib.c
-       gcc -g -c `sh ../tools/dyncflags.sh` lib.c -o lib.o -Wall -Werror
-
-$(SHARED): lib.o
-       sh ../tools/buildshared.sh $(SHARED) lib.o
-
-runtests: runtests.c $(SHARED) ../lib/libcinvoke.a
-       gcc -g -DCINVOKE_BUILD $(BUILDARCH) -o runtests runtests.c -Wall 
-Werror -L../lib -I../lib `sh ../tools/libdl.sh` -lcinvoke -lm

Added: trunk/cinvoke/test/Makefile.templ
===================================================================
--- trunk/cinvoke/test/Makefile.templ                           (rev 0)
+++ trunk/cinvoke/test/Makefile.templ   2006-07-15 03:38:35 UTC (rev 92)
@@ -0,0 +1,15 @@
+SHARED = lib.$DYNEXT
+
+all: \$(SHARED) runtests
+
+clean:
+       rm -f lib.o \$(SHARED) runtests
+
+lib.o: lib.c
+       gcc -g -c $DYNCFLAGS lib.c -o lib.o -Wall -Werror
+
+\$(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





reply via email to

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