Merge branch 'master' of github.com:heimdal/heimdal
[heimdal.git] / windows / maint.el
bloba76179d85bf7f81a37cb03a83aa170d0f8212bae
3 (defun generate-obj-macro (mname &optional postfix &rest slist)
4 "Generates a macro definition for an OBJs dependency based on a list of source definitions"
6 (let*
7 ((replist (apply 'append (mapcar (lambda (sdef)
8 (goto-char 0)
9 (let*
10 ((def (buffer-substring-no-properties
11 (search-forward (concat sdef " = \\\n") nil t)
12 (search-forward "\n\n" nil t)))
13 (st (split-string
14 (replace-regexp-in-string "^.*\\.h.*\n" "" def)
15 "\\s-+\\\\?\\|\n" t)))
16 st)) slist)))
17 (def-start (search-forward (concat mname " = \\\n") nil t))
18 (def-end (search-forward "\n\n" nil t))
20 (repl (mapconcat
21 (lambda (s)
22 (concat "\t"
23 (replace-regexp-in-string
24 "\\(\\s-*\\)\\(.*\\)\\.c" "\\1$(OBJ)\\\\\\2.obj" s)
25 " \\"))
26 replist "\n"))
27 (erepl (if postfix
28 (concat repl "\n" postfix "\n\n")
29 (concat repl "\n\n")))
31 (delete-region def-start def-end)
32 (insert erepl))