Function: ede-proj-makefile-insert-dist-rules

ede-proj-makefile-insert-dist-rules is a byte-compiled function defined in pmake.el.gz.

Signature

(ede-proj-makefile-insert-dist-rules ARG &rest ARGS)

Implementations

((this ede-proj-project)) in `ede/pmake.el'.

Insert distribution rules for THIS in a Makefile, such as CLEAN and DIST.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/ede/pmake.el.gz
(cl-defmethod ede-proj-makefile-insert-dist-rules ((this ede-proj-project))
  "Insert distribution rules for THIS in a Makefile, such as CLEAN and DIST."
  (let ((junk (ede-proj-makefile-garbage-patterns this))
	tmp)
    ;; Build CLEAN, DIST, TAG, and other rules here.
    (if junk
	(insert "\nclean:\n"
		"\trm -f "
		(mapconcat (lambda (c) c) junk " ")
		"\n\n"))
    ;; @TODO: ^^^ Clean should also recurse. ^^^

    (insert ".PHONY: dist\n")
    (insert "\ndist:")
    (ede-proj-makefile-insert-dist-dependencies this)
    (insert "\n")
    (unless (or (ede-subproject-p this)
		(oref this metasubproject))
      ;; Only delete if we are the toplevel project.
      (insert "\trm -rf $(DISTDIR)\n"))
    (insert "\tmkdir $(DISTDIR)\n")	;We may need a -p, but I think not.
    (setq tmp (oref this targets))
    (insert "\tcp")
    (while tmp
      (let ((sv (ede-proj-makefile-sourcevar (car tmp))))
	(if (listp sv)
	    ;; Handle special case variables.
	    (cond ((eq (cdr sv) 'share)
		   ;; This variable may be shared between multiple targets.
		   (if (re-search-backward (concat "\\$(" (car sv) ")")
					   (point-at-bol) t)
		       ;; If its already in the dist target, then skip it.
		       nil
		     (setq sv (car sv))))
		  (t (setq sv (car sv)))))
	(if (stringp sv)
	    (insert " $(" sv ")"))
	(ede-proj-makefile-insert-dist-filepatterns (car tmp))
	(setq tmp (cdr tmp))))
    (insert " $(ede_FILES) $(DISTDIR)\n")

    ;; Call our sub projects.
    (ede-map-subprojects
     this (lambda (sproj)
	    (let ((rp (directory-file-name (ede-subproject-relative-path sproj))))
	      (insert "\t$(MAKE) -C " rp " $(MFLAGS) DISTDIR=$(DISTDIR)/" rp
		      " dist"
		      "\n"))))

    ;; Tar up the stuff.
    (unless (or (ede-subproject-p this)
		(oref this metasubproject))
      (insert "\ttar -cvzf $(DISTDIR).tar.gz $(DISTDIR)\n"
	      "\trm -rf $(DISTDIR)\n"))

    ;; Make sure the Makefile is ok.
    (insert "\n"
	    (file-name-nondirectory (buffer-file-name)) ": "
	    (file-name-nondirectory (oref this file)) "\n"
;;	    "$(EMACS) -batch Project.ede -l ede -f ede-proj-regenerate"
	    "\t@echo Makefile is out of date!  "
	    "It needs to be regenerated by EDE.\n"
	    "\t@echo If you have not modified Project.ede, you can"
	    (format-message
             " use `touch' to update the Makefile time stamp.\n")
	    "\t@false\n\n"
	    "\n\n# End of Makefile\n")))