Author: matt
Date: 2011-08-02 02:27:30 -0700 (Tue, 02 Aug 2011)
New Revision: 8897
Log:
Fluid3:
 - generating Makefiles now calculates the correct relative path
 - all sources for fltk.lib are now generate by Fluid


Modified:
   branches/branch-3.0/Makefile
   branches/branch-3.0/fluid/Fl_Type.cxx
   branches/branch-3.0/fluid/Fl_Type.h
   branches/branch-3.0/fluid/file_make.cxx
   branches/branch-3.0/ide/templates/Makefile.tmpl
   branches/branch-3.0/src/Makefile

Modified: branches/branch-3.0/Makefile
===================================================================
--- branches/branch-3.0/Makefile        2011-08-02 08:49:28 UTC (rev 8896)
+++ branches/branch-3.0/Makefile        2011-08-02 09:27:30 UTC (rev 8897)
@@ -27,7 +27,7 @@
 
 include makeinclude
 
-DIRS = $(IMAGEDIRS) src $(CAIRODIR) fluid test fluid1 test1 documentation
+DIRS = $(IMAGEDIRS) src $(CAIRODIR) fluid test documentation
 
 all: makeinclude fltk-config
        for dir in $(DIRS); do\
@@ -48,8 +48,6 @@
        cd documentation; $(MAKE) $(MFLAGS) $(INSTALL_DESKTOP)
        cd fluid; $(MAKE) $(MFLAGS) $(INSTALL_DESKTOP)
        cd test; $(MAKE) $(MFLAGS) $(INSTALL_DESKTOP)
-       cd fluid1; $(MAKE) $(MFLAGS) $(INSTALL_DESKTOP)
-       cd test1; $(MAKE) $(MFLAGS) $(INSTALL_DESKTOP)
 
 uninstall: makeinclude
        $(RM) $(DESTDIR)$(bindir)/fltk-config
@@ -62,8 +60,6 @@
        cd documentation; $(MAKE) $(MFLAGS) $(UNINSTALL_DESKTOP)
        cd fluid; $(MAKE) $(MFLAGS) $(UNINSTALL_DESKTOP)
        cd test; $(MAKE) $(MFLAGS) $(UNINSTALL_DESKTOP)
-       cd fluid1; $(MAKE) $(MFLAGS) $(UNINSTALL_DESKTOP)
-       cd test1; $(MAKE) $(MFLAGS) $(UNINSTALL_DESKTOP)
 
 depend: makeinclude
        for dir in $(DIRS); do\

Modified: branches/branch-3.0/fluid/Fl_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.cxx       2011-08-02 08:49:28 UTC (rev 
8896)
+++ branches/branch-3.0/fluid/Fl_Type.cxx       2011-08-02 09:27:30 UTC (rev 
8897)
@@ -1478,6 +1478,20 @@
   return 0;
 }
 
+const char *Fl_File_Type::filename_relative(const char *fnbase, const char 
*tgtbase) {
+  char src_name[2048];
+  static char result[2048];
+  const char *fn = filename();
+  if (fn) {
+    strcpy(src_name, fnbase);
+    strcat(src_name, fn);
+    fltk3::filename_relative(result, 2048, src_name, tgtbase);
+    return result;
+  } else {
+    return 0;
+  }
+}
+
 void Fl_File_Type::open() {
   if (!the_file_panel) the_file_panel = make_file_panel();
   the_file_panel->load(&Fl_Type::is_file);

Modified: branches/branch-3.0/fluid/Fl_Type.h
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.h 2011-08-02 08:49:28 UTC (rev 8896)
+++ branches/branch-3.0/fluid/Fl_Type.h 2011-08-02 09:27:30 UTC (rev 8897)
@@ -293,6 +293,7 @@
   void filename(const char *new_name);
   const char *filename() { return pFilename; }
   const char *filename_name();
+  const char *filename_relative(const char *fnbase, const char *tgtbase);
   virtual void open();
   virtual void write_properties();
   virtual char read_property(const char *);

Modified: branches/branch-3.0/fluid/file_make.cxx
===================================================================
--- branches/branch-3.0/fluid/file_make.cxx     2011-08-02 08:49:28 UTC (rev 
8896)
+++ branches/branch-3.0/fluid/file_make.cxx     2011-08-02 09:27:30 UTC (rev 
8897)
@@ -43,10 +43,12 @@
 int write_fltk_makefiles() {
   // for now, we use a template file in FLTK/ide/templates/Makefile.tmpl .
   // When done, everything will likely be integrated into the executable to 
make one compact package.
-  
-  char buf[2048];
-  strcpy(buf, filename);
-  strcpy((char*)fltk3::filename_name(buf), "ide/templates/Makefile.tmpl");
+  char buf[2048], base_dir[2048], tgt_base[2048];
+  strcpy(base_dir, filename);
+  *((char*)fltk3::filename_name(base_dir)) = 0; // keep only the path
+  strcpy(tgt_base, base_dir);
+  strcpy(buf, base_dir);
+  strcat(buf, "ide/templates/Makefile.tmpl");
   FILE *out = stdout;
   FILE *in = fopen(buf, "rb");
   
@@ -65,17 +67,25 @@
       } else { // single hash is a command
         copyLine = 0;
         if (strncmp(hash, "#WriteFile(",11)==0) {
-          char fnbuf[2048];
+          // mark the end of the filename (this will crash if the formatting 
is wrong!)
           char *sep = strchr(hash, ')');
           *sep = 0;
-          strcpy(fnbuf, filename);
-          strcpy((char*)fltk3::filename_name(fnbuf), hash+11);
+          // filename is relative, so add it to the base_dir
+          char fnbuf[2048];
+          strcpy(fnbuf, base_dir);
+          strcat(fnbuf, hash+11);
+          out = fopen(fnbuf, "wb");
+          // set the filepath for this target. In this module, all filenames 
are relative to the Makefile
+          strcpy(tgt_base, fnbuf);
+          *((char*)fltk3::filename_name(tgt_base)) = 0; // keep only the path
+          // restore buffer and continue 
           *sep = ')';
-          out = fopen(fnbuf, "wb");
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#CloseFile", 10)==0) {
           if (out!=stdout) fclose(out);
           out = stdout;
+          // set the filepath for the default target. 
+          strcpy(tgt_base, base_dir);
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#CppFiles(", 10)==0) {
           Fl_Type *tgt = Fl_Target_Type::find(hash+10, ')'); // keep tgt local
@@ -88,7 +98,7 @@
           for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
             if (f->is_cplusplus_code() && f->builds_in(ENV_MAKE)) {
               if (first) { fprintf(out, "CPPFILES = "); first=0; }
-              fprintf(out, " \\\n\t%s", f->filename_name());
+              fprintf(out, " \\\n\t%s", f->filename_relative(base_dir, 
tgt_base));
             }
           }
           if (!first) fprintf(out, "\n");
@@ -104,11 +114,27 @@
           for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
             if (f->is_objc_code() && f->builds_in(ENV_MAKE)) {
               if (first) { fprintf(out, "OBJCPPFILES = "); first=0; }
-              fprintf(out, " \\\n\t%s", f->filename_name());
+              fprintf(out, " \\\n\t%s", f->filename_relative(base_dir, 
tgt_base));
             }
           }
           if (!first) fprintf(out, "\n");
           hash = strchr(hash, ';')+1;
+        } else if (strncmp(hash, "#CFiles(", 8)==0) {
+          Fl_Type *tgt = Fl_Target_Type::find(hash+8, ')'); // keep tgt local
+          if (!tgt) {
+            printf("ERROR writing Makefile: target not found!");
+            return -1;
+          }
+          char first = 1;
+          Fl_File_Type *f;
+          for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+            if (f->is_c_code() && f->builds_in(ENV_MAKE)) {
+              if (first) { fprintf(out, "CFILES = "); first=0; }
+              fprintf(out, " \\\n\t%s", f->filename_relative(base_dir, 
tgt_base));
+            }
+          }
+          if (!first) fprintf(out, "\n");
+          hash = strchr(hash, ';')+1;
         } else {
           printf("Unknown command in template: <<%s>>\n", hash);
           copyLine = 1;

Modified: branches/branch-3.0/ide/templates/Makefile.tmpl
===================================================================
--- branches/branch-3.0/ide/templates/Makefile.tmpl     2011-08-02 08:49:28 UTC 
(rev 8896)
+++ branches/branch-3.0/ide/templates/Makefile.tmpl     2011-08-02 09:27:30 UTC 
(rev 8897)
@@ -172,25 +172,15 @@
        Fl_PNG_Image.cxx \
        Fl_PNM_Image.cxx
 
+#CFiles(fltk);
 
-CFILES = flstring.c vsnprintf.c
-
-UTF8CFILES = \
-       xutf8/case.c \
-       xutf8/is_right2left.c \
-       xutf8/is_spacing.c \
-       xutf8/keysym2Ucs.c \
-       xutf8/utf8Input.c \
-       xutf8/utf8Utils.c \
-       xutf8/utf8Wrap.c
-
 
################################################################################################################################
 FLTKFLAGS = -DFL_LIBRARY
 include ../makeinclude
 
 MMFILES = $(shell if test $(USEMMFILES) = Yes; then echo $(OBJCPPFILES); fi)
 
-OBJECTS =  $(MMFILES:.mm=.o) $(CPPFILES:.cxx=.o) $(CFILES:.c=.o) 
$(UTF8CFILES:.c=.o)
+OBJECTS =  $(MMFILES:.mm=.o) $(CPPFILES:.cxx=.o) $(CFILES:.c=.o)
 GLOBJECTS = $(GLCPPFILES:.cxx=.o)
 FLOBJECTS = $(FLCPPFILES:.cxx=.o)
 IMGOBJECTS = $(IMGCPPFILES:.cxx=.o)
@@ -399,9 +389,9 @@
                libfltk_gl.dylib libfltk_images.dylib \
                cmap core
 
-depend:        $(CPPFILES) $(MMFILES) $(FLCPPFILES) $(GLCPPFILES) 
$(IMGCPPFILES) $(CFILES) $(UTF8CFILES)
+depend:        $(CPPFILES) $(MMFILES) $(FLCPPFILES) $(GLCPPFILES) 
$(IMGCPPFILES) $(CFILES)
        makedepend -Y -I.. -f makedepend $(CPPFILES) $(MMFILES) $(FLCPPFILES) \
-               $(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES)
+               $(GLCPPFILES) $(IMGCPPFILES) $(CFILES)
 
 ## Automatically generated dependencies... generated on a Linux/Unix host !
 include makedepend

Modified: branches/branch-3.0/src/Makefile
===================================================================
--- branches/branch-3.0/src/Makefile    2011-08-02 08:49:28 UTC (rev 8896)
+++ branches/branch-3.0/src/Makefile    2011-08-02 09:27:30 UTC (rev 8897)
@@ -200,17 +200,12 @@
        Fl_PNG_Image.cxx \
        Fl_PNM_Image.cxx
 
-
-CFILES = flstring.c vsnprintf.c
-
-UTF8CFILES = \
+CFILES =  \
+       flstring.c \
+       vsnprintf.c \
        xutf8/case.c \
        xutf8/is_right2left.c \
-       xutf8/is_spacing.c \
-       xutf8/keysym2Ucs.c \
-       xutf8/utf8Input.c \
-       xutf8/utf8Utils.c \
-       xutf8/utf8Wrap.c
+       xutf8/is_spacing.c
 
 ################################################################
 FLTKFLAGS = -DFL_LIBRARY
@@ -218,7 +213,7 @@
 
 MMFILES = $(shell if test $(USEMMFILES) = Yes; then echo $(OBJCPPFILES); fi)
 
-OBJECTS =  $(MMFILES:.mm=.o) $(CPPFILES:.cxx=.o) $(CFILES:.c=.o) 
$(UTF8CFILES:.c=.o)
+OBJECTS =  $(MMFILES:.mm=.o) $(CPPFILES:.cxx=.o) $(CFILES:.c=.o)
 GLOBJECTS = $(GLCPPFILES:.cxx=.o)
 FLOBJECTS = $(FLCPPFILES:.cxx=.o)
 IMGOBJECTS = $(IMGCPPFILES:.cxx=.o)
@@ -427,9 +422,9 @@
                libfltk_gl.dylib libfltk_images.dylib \
                cmap core
 
-depend:        $(CPPFILES) $(MMFILES) $(FLCPPFILES) $(GLCPPFILES) 
$(IMGCPPFILES) $(CFILES) $(UTF8CFILES)
+depend:        $(CPPFILES) $(MMFILES) $(FLCPPFILES) $(GLCPPFILES) 
$(IMGCPPFILES) $(CFILES)
        makedepend -Y -I.. -f makedepend $(CPPFILES) $(MMFILES) $(FLCPPFILES) \
-               $(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES)
+               $(GLCPPFILES) $(IMGCPPFILES) $(CFILES)
 
 # Automatically generated dependencies... generated on a Linux/Unix host !
 include makedepend

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to