org2blog/common/l2r-remote-url treats "file:///" prefix now
[org2blog.git] / make-target.el
blobdb4d572fa234804ad12947aad6a5b284d308e4bc
1 ;;;_ org2blog/make-target.el --- Help to make converted files
3 ;;;_. Headers
4 ;;;_ , License
5 ;; Copyright (C) 2010 Tom Breton (Tehom)
7 ;; Author: Tom Breton (Tehom) <tehom@panix.com>
8 ;; Keywords: lisp, internal
10 ;; This file is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
15 ;; This file is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;;;_ , Commentary:
27 ;; Basically calls make. Assumes makefile has already been set up.
30 ;;;_ , Requires
32 ;;;_. Body
34 ;;;_ , Medium-general: link conversion help
36 ;;;_ . org2blog:convert-filename
37 (defun org2blog:convert-filename (path suffix target-prefix src-prefix)
39 (let*
40 ((path-se (file-name-sans-extension path))
41 ;;Relative to source top directory
42 (rel-path-se
43 (file-relative-name
44 path-se
45 (expand-file-name src-prefix)))
46 ;;Relocated to target top directory
47 (target-path-se
48 (expand-file-name
49 rel-path-se
50 target-prefix)))
51 ;;With the new suffix
52 (concat target-path-se suffix)))
54 ;;;_ . org2blog:make-target
55 (defun org2blog:make-target (filename)
57 ;;This completely relies on having "make" already set up properly.
58 ;;Using elmake would be an alternative to make.
60 (let ((status
61 (call-process "make" nil nil nil filename)))
62 (unless
63 (equal status 0)
64 (error "Failed to make %s" filename))))
66 ;;;_. Footers
67 ;;;_ , Provides
69 (provide 'org2blog/make-target)
71 ;;;_ * Local emacs vars.
72 ;;;_ + Local variables:
73 ;;;_ + mode: allout
74 ;;;_ + End:
76 ;;;_ , End
77 ;;; org2blog/make-target.el ends here