Commits

Anonymous committed 6640ccd

First working version of build-make custom interface to build-with-MS.
Working around xemacs.mak structural shortcomings by defining interface to
XPM_DIR
PNG_DIR
ZLIB_DIR
TIFF_DIR
JPEG_DIR
COMPFACE_DIR
in build.el. It cannot be derived from xemacs.mak.
All macros defined in xemacs.mak according to
`build-make-macro-paragraph' appear in the custom-interface.

  • Participants
  • Parent commits 69c10ea

Comments (0)

Files changed (1)

 ;;;  makefile-macroassign-regex
   "REGEXP matching a XEmacs makefile macro definition.")
 
+(defconst build-make-prolog
+  "
+(provide 'build-make)
+
+(setq build-make-options nil)
+
+(defun sym-to-opt (sym)
+  (substring (symbol-name sym) 11))
+
+(defun build-set-value (sym val)
+  (cond
+   ((equal val (first (get sym 'standard-value)))
+    (setq build-make-options (remassoc (sym-to-opt sym) build-make-options)))
+   (t
+    (setq build-make-options 
+	  (acons (sym-to-opt sym) val
+		 build-make-options))))
+  (set-default sym val))
+
+(defgroup build-make nil
+  \"build-make options.\"
+  :group 'build)
+
+"
+  "Internal variable of `build'.")
+
 (defvar build-from-what
   'Tarball
   "The Source Code units XEmacs is to be built from ('Tarball or 'CVS).")
 
 (defcustom build-with-MS-make-command
   "nmake"
-  "Path of MicroSoft make utility used to build XEmacs."
+  "Path of Microsoft make utility used to build XEmacs."
   :type 'file
   :group 'build-with-MS)
 
 (defcustom build-with-MS-make-options
-  "/n /f xemacs.mak"
-  "Options to use with MicroSoft make utility when building XEmacs."
-  :type 'string
+  nil
+  "Options to use with Microsoft make utility when building XEmacs."
+  :type '(repeat string)
   :group 'build-with-MS)
 
 (defgroup build-tarball nil
   (interactive "sTarget: \nsCommand: ")
   (let ((cmd
 	 (if (string-equal command "")
-	     (concat "make " target)
-	   (concat command " " target)))
+	     (format "make %s" target)
+	   (format "%s %s" command target)))
 	(compilation-mode-hook
 	 'build-compilation-mode-hook)
 	(compilation-buffer-name-function
 	 '(lambda (mode)
 	    (generate-new-buffer-name
-	     (concat
-	      (cond
-	       ((equal build-from-what 'Tarball)
-		build-tarball-prefix)
-	       ((equal build-from-what 'CVS)
-		build-cvs-xemacs-module))
-	      "-make"
-	      (when target
-		(format "-%s" target))
-	      ".err")))))
+	     (format "%s-make%s.err"
+		     (cond
+		      ((equal build-from-what 'Tarball)
+		       build-tarball-prefix)
+		      ((equal build-from-what 'CVS)
+		       build-cvs-xemacs-module))
+		     (if target
+			 (format "-%s" target)
+		       ""))))))
     (compile cmd)))
 
 (defun build-get-tarballs ()
 		   :notify (lambda (widget &rest ignore)
 			     (setq build-with-what (widget-value widget)))
 		   '(item :value "GNU Tools")
-		   '(item :value "MicroSoft Tools")
+		   '(item :value "Microsoft Tools")
 		   )
     (widget-insert
-     "GNU tools using configure and make or MicroSoft Tools using
+     "GNU tools using configure and make or Microsoft Tools using
 nt\\xemacs.mak and VC++5.0.")
     (widget-insert
      "\n\nThen you're ready to ")
 				(expand-file-name
 				 build-cvs-xemacs-module
 				 build-cvs-working-dir)))
-			      ((string-equal build-with-what "MicroSoft Tools")
+			      ((string-equal build-with-what "Microsoft Tools")
 			       (build-with-MS
 				(expand-file-name
 				 build-cvs-xemacs-module
     (goto-char (point-min))))
 
 (defun build-with-MS (dir)
-  (interactive)
+  (interactive "DXEmacs source directry: ")
   (let
-      ((name "*Build XEmacs With MicroSoft Tools*"))
+      ((name "*Build XEmacs With Microsoft Tools*"))
     (kill-buffer (get-buffer-create name))
     (switch-to-buffer (get-buffer-create name))
     (kill-all-local-variables)
     (cd (expand-file-name "nt" dir))
     (widget-insert "\n")
     (widget-insert
-     "\nYou may customize MicroSoft Tools options.\n\n")
+     "\nYou may customize Microsoft Tools options.\n\n")
     (widget-create 'push-button
 		   :notify (lambda (&rest ignore)
 			     (customize-browse 'build-with-MS))
 		    "Activate Generated Build Make")
      (if (boundp 'build-make-options)
 	 :deactivate
-       :activate))
+       :activate)
+     )
     (when (boundp 'build-make-options)
-      (widget-insert "\n\t")
       (widget-insert
-       "You will need to restart XEmacs to activate
+       "\n\tYou will need to restart XEmacs to activate
 	the generated interface to Build Make.\n\n"))
+    (widget-insert "\n\t")
     (widget-create 'push-button
 		   :notify (lambda (&rest ignore)
 			     (customize-browse 'build-make))
 		   :notify (lambda (&rest ignore)
 			     (build-make
 			      "distclean"
-			      (format "%s %s"
-			       build-with-MS-make-command
-			       build-with-MS-make-options)))
+			      (mapconcat
+			       'identity
+			       (cons
+				build-with-MS-make-command
+				build-with-MS-make-options)
+			       " ")))
 		   "Clean XEmacs Distribution")
     (widget-insert "\n\n")
     (widget-create 'push-button
 		   :notify (lambda (&rest ignore)
 			     (build-make
 			      "all"
-			      (format "%s %s %s"
-			       build-with-MS-make-command
-			       build-with-MS-make-options
+			      (concat
+			       (mapconcat
+				'identity
+				(cons
+				 build-with-MS-make-command
+				 build-with-MS-make-options)
+				" ")
 			       (build-make-get-option-string))))
 ;;; 			       " USE_ASSERTIONS=1 ASSERTIONS_DONT_ABORT=1"
 ;;; 			       " ERROR_CHECK_GC=1 ERROR_CHECK_BUFPOS=1 DEBUG_XEMACS=1")))
 		   :notify (lambda (&rest ignore)
 			     (build-make
 			      "install"
-			      (format "%s %s %s"
-			       build-with-MS-make-command
-			       build-with-MS-make-options
+			      (concat
+			       (mapconcat
+				'identity
+				(cons
+				 build-with-MS-make-command
+				 build-with-MS-make-options)
+				" ")
 			       (build-make-get-option-string))))
 ;;; 			       " USE_ASSERTIONS=1 ASSERTIONS_DONT_ABORT=1"
 ;;; 			       " ERROR_CHECK_GC=1 ERROR_CHECK_BUFPOS=1 DEBUG_XEMACS=1")))
     (goto-char (point-min))))
 
 (defun build-make-get-option-string ()
-  (mapconcat
-   (function (lambda (e)
-	       (cond
-		(t
-		 (format " %s=%s" (first e) (rest e))))))
-   (delete-duplicates
-    build-make-options :from-end t
-    :test (lambda (a b)
-	    (string=
-	     (first a) (first b))))
-   ""))
+  (if (boundp 'build-make-options)
+      (mapconcat
+       (function (lambda (e)
+		   (cond
+		    (t
+		     (format " %s=%S" (first e) (rest e))))))
+       (delete-duplicates
+	build-make-options :from-end t
+	:test (lambda (a b)
+		(string=
+		 (first a) (first b))))
+       "")
+    ""))
 
 (defun build-build-report ()
   (interactive)
 	    (append (list (list name value)) (cdr (assoc 'macros a-list))))))
 
 (defun build-make-customize (a-list)
-  (princ "
-(provide 'build-make)
-
-(setq build-make-options nil)
-
-(defun sym-to-opt (sym)
-  (substring (symbol-name sym) 11))
-
-(defun build-set-value (sym val)
+  (princ build-make-prolog)
   (cond
-   ((equal val (first (get sym 'standard-value)))
-    (setq build-make-options (remassoc (sym-to-opt sym) build-make-options)))
-   (t
-    (setq build-make-options 
-	  (acons (sym-to-opt sym) val
-		 build-make-options))))
-  (set-default sym val))
-
-(defgroup build-make nil
-  \"build-make options.\"
-  :group 'build)
-
-")
+   ((string-equal build-with-what
+		  "GNU Tools")
+    nil)
+   ((string-equal build-with-what
+		  "Microsoft Tools")
+    (mapcar
+     (lambda (macro)
+       (build-make-file (first macro) (second macro))
+       )
+     (list
+      (list "XPM_DIR" "")
+      (list "PNG_DIR" "")
+      (list "ZLIB_DIR" "")
+      (list "TIFF_DIR" "")
+      (list "JPEG_DIR" "")
+      (list "COMPFACE_DIR" "")))))
   (mapcar 
    (lambda (macro)
      (build-make-string (first macro) (second macro))
   (princ (format "  %S\n" val))
   (princ (format "  \"macro %s\"\n" name))
   (princ (format "  :group \'build-make\n"))
-;;;   (princ "  :type '(string)\n")
   (princ "  :type 'string\n")
   (princ "  :set 'build-set-value)\n")
   (princ "\n"))
 
+(defun build-make-file (name val)
+  (princ (format "(defcustom build-make-%s\n" name))
+  (princ (format "  %S\n" val))
+  (princ (format "  \"macro %s\"\n" name))
+  (princ (format "  :group \'build-make\n"))
+  (princ "  :type 'file\n")
+  (princ "  :set 'build-set-value)\n")
+  (princ "\n"))
+
 (provide 'build)
 
 ;; build.el ends here