Makefile
changeset 270 19082e26bea6
parent 249 22e93995e88a
child 275 2f79af90c708
equal deleted inserted replaced
269:48b3cbdac750 270:19082e26bea6
     8 # Disable built in suffix rules.
     8 # Disable built in suffix rules.
     9 .SUFFIXES:
     9 .SUFFIXES:
    10 # Default target.
    10 # Default target.
    11 .DEFAULT_GOAL = help
    11 .DEFAULT_GOAL = help
    12 
    12 
    13 .PHONY: all
    13 ################################################################
    14 all:
    14 # Platform definition.
    15 
    15 
    16 ifeq '' '$(HOME)'
    16 ifeq '' '$(HOME)'
    17   $(error HOME env var not set!)
    17   $(error HOME env var not set!)
    18 endif
    18 endif
    19 
    19 
    20 host_os = linux
    20 host_os = linux
    21 ifneq '' '$(COMSPEC)'
    21 ifneq '' '$(COMSPEC)'
    22   host_os = windows
    22   host_os = cygwin
       
    23 endif
       
    24 
       
    25 ################################################################
       
    26 # Build tool definition/switches.
       
    27 
       
    28 RST2HTML = rst2html
       
    29 ifeq '$(host_os)' 'cygwin'
       
    30   RST2HTML = rst2html.py
    23 endif
    31 endif
    24 
    32 
    25 ################################################################
    33 ################################################################
    26 # Project dirs/files.
    34 # Project dirs/files.
    27 
    35 
    28 OVERRIDDEN_ITEMS = \
    36 OVERRIDDEN_ITEMS = \
    29     .inputrc .minttyrc .Xdefaults .xinitrc .xserverrc .screenrc .dircolors \
    37     .inputrc .minttyrc .Xdefaults .xinitrc .xserverrc .screenrc .dircolors \
    30     .bashrc .bash_completion .zshrc .vimrc .ssh \
    38     .bashrc .bash_completion .zshrc .vimrc .ssh .pystartup \
    31     .mailsign .muttrc .tidy \
    39     .signature .muttrc .tidy \
    32     .dictrc \
    40     .dictrc \
    33     .hgrc .hgignore .bazaar .gitconfig .gitignore .cvs \
    41     .hgrc .hgignore .hgstyle .bazaar .gitconfig .gitignore .cvs \
    34     .gnupg
    42     .gnupg
    35 MANUALINSTALL_ITEMS = .mc
    43 MANUALINSTALL_ITEMS = .mc
    36 IFNONEXIST_ITEMS = .wgetrc .subversion
    44 IFNONEXIST_ITEMS = .wgetrc .subversion
       
    45 
       
    46 RST_FILES = $(wildcard *.rst)
       
    47 HTML_FILES = $(RST_FILES:.rst=.html)
       
    48 
       
    49 ################################################################
       
    50 # Build targets.
       
    51 
       
    52 .PHONY: all
       
    53 all:
    37 
    54 
    38 ################################################################
    55 ################################################################
    39 # Install/uninstall targets.
    56 # Install/uninstall targets.
    40 
    57 
    41 .PHONY: install
    58 .PHONY: install
    70 			done; \
    87 			done; \
    71 		fi; \
    88 		fi; \
    72 	done
    89 	done
    73 	mkdir -p $(HOME)/.mc
    90 	mkdir -p $(HOME)/.mc
    74 	install -m 640 .mc/bashrc $(HOME)/.mc
    91 	install -m 640 .mc/bashrc $(HOME)/.mc
    75 ifeq '$(host_os)' 'windows'
    92 ifeq '$(host_os)' 'cygwin'
    76 	install -m 640 .mc/bindings.cygwin $(HOME)/.mc/bindings
    93 	install -m 640 .mc/bindings.cygwin $(HOME)/.mc/bindings
    77 else
    94 else
    78 	install -m 640 .mc/bindings $(HOME)/.mc/bindings
    95 	install -m 640 .mc/bindings $(HOME)/.mc/bindings
    79 endif
    96 endif
    80 
    97 
    96 	done
   113 	done
    97 	rm -f $(HOME)/.mc/bashrc $(HOME)/.mc/ini $(HOME)/.mc/bindings
   114 	rm -f $(HOME)/.mc/bashrc $(HOME)/.mc/ini $(HOME)/.mc/bindings
    98 	rmdir $(HOME)/.mc || :
   115 	rmdir $(HOME)/.mc || :
    99 
   116 
   100 ################################################################
   117 ################################################################
       
   118 # Docs targets.
       
   119 
       
   120 .PHONY: html
       
   121 html: $(HTML_FILES)
       
   122 
       
   123 # --stylesheet=rst.css
       
   124 $(HTML_FILES): %.html: %.rst
       
   125 	$(RST2HTML) $*.rst $@
       
   126 
       
   127 ################################################################
   101 # Clean targets.
   128 # Clean targets.
   102 
   129 
   103 .PHONY: clean
   130 .PHONY: clean
   104 clean:
   131 clean:
       
   132 	rm -f $(HTML_FILES)
   105 
   133 
   106 .PHONY: distclean
   134 .PHONY: distclean
   107 distclean: clean
   135 distclean: clean
   108 
   136 
   109 ################################################################
   137 ################################################################