Author: vedge
Date: 2008-10-26 07:40:56 -0300 (Sun, 26 Oct 2008)
New Revision: 760

Modified:
   trunk/mkprojfiles.pl
Log:
transform "-Dfoo" instances in $CFLAGS into package.defines entries.


Modified: trunk/mkprojfiles.pl
===================================================================
--- trunk/mkprojfiles.pl        2008-10-26 07:37:41 UTC (rev 759)
+++ trunk/mkprojfiles.pl        2008-10-26 10:40:56 UTC (rev 760)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -I%PREFIX%/share/bsdbuild
 #
-# Copyright (c) 2007 Hypertriton, Inc. <http://hypertriton.com/>
+# Copyright (c) 2008 Hypertriton, Inc. <http://hypertriton.com/>
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -24,6 +24,31 @@
 # USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE..
 #
 
+#
+# Read a BSDBuild Makefile on standard input and output the Premake script
+# which will be used by <build.proj.mk> to generate IDE project files.
+# 
+# Premake project information is obtained from assignments to the standard
+# BSDBuild variables:
+#
+#      SUBDIR          -> Recurse using Premake dopackage()
+#      PROJECT         -> Premake project name
+#      PROJECT_GUID    -> Project GUID
+#      LIB             -> Use as output library name
+#      LIB_GUID        -> Library GUID
+#      LIB_LINKS       -> Explicitely linked libraries (for non-Unix platforms)
+#      LIB_SHARED      -> Produce dynamic linkable libraries
+#      LIB_STATIC      -> Produce static libraries
+#      PROG            -> Use as output program name
+#      PROG_GUID       -> Program GUID
+#      PROG_LINKS      -> Explicitely linked libraries (for non-Unix platforms)
+#      PROG_TYPE       -> Set program interface ("GUI" or "CLI")
+#      SRCS            -> List of source files
+#      CFLAGS          -> Compiler options, used as follows:
+#
+#              -I<pathname>    -> Add to package.includepaths
+#              -D<define>      -> Add to package.defines
+
 use BSDBuild::Core;
 
 my @lines = ();
@@ -124,11 +149,16 @@
        if (@cflags) {
                foreach my $cflag (@cflags) {
                        my $handled = 0;
-                       if ($cflag =~ /^-I\s*([\w\-\.\/]+)$/) {
+                       if ($cflag =~ /^-I\s*([\w\-\.\/]+)\s*$/) {
                                print "tinsert(package.includepaths,".
                                      "{\"$1\"})\n";
                                next;
                        }
+                       if ($cflag =~ /^-D\s*(\w+)\s*$/) {
+                               print "tinsert(package.defines,".
+                                     "{\"$1\"})\n";
+                               next;
+                       }
                        if ($cflag =~ /^\${([\w\-\.]+)}$/) { $cflag = $1; }
                        elsif ($cflag =~ /^\$([\w\-\.]+)$/) { $cflag = $1; }
                        #foreach my $fn (values %cflagSubstFn) {

_______________________________________________
BSDBuild-Commits mailing list
[email protected]
http://mail231.csoft.net/mailman/listinfo/bsdbuild-commits

Reply via email to