Makefile
changeset 66 be91c79007e9
parent 63 f1bd82604661
child 68 ce7aca59cb54
equal deleted inserted replaced
65:2137ea6bb456 66:be91c79007e9
    19 .SUFFIXES:
    19 .SUFFIXES:
    20 # Default target.
    20 # Default target.
    21 .DEFAULT_GOAL = all
    21 .DEFAULT_GOAL = all
    22 
    22 
    23 ################################################################
    23 ################################################################
       
    24 # Platform/environment definition.
       
    25 
       
    26 host_os = unix
       
    27 ifneq '' '$(COMSPEC)'
       
    28   ifneq '' '$(WINDIR)'
       
    29     # Probably under Windows.
       
    30     host_os = windows
       
    31   endif
       
    32 endif
       
    33 
       
    34 ################################################################
       
    35 # Build tool definition/switches.
       
    36 
       
    37 RST2HTML = rst2html
       
    38 ifeq '$(host_os)' 'windows'
       
    39   RST2HTML = rst2html.py
       
    40 endif
       
    41 
       
    42 ################################################################
    24 # Install paths.
    43 # Install paths.
    25 
    44 
    26 ifeq '$(origin prefix)' 'undefined'
    45 ifeq '$(origin prefix)' 'undefined'
    27   ifeq '$(shell id -u)' '0'
    46   ifeq '$(shell id -u)' '0'
    28     prefix = /usr/local
    47     prefix = /usr/local
    32 endif
    51 endif
    33 datarootdir = $(prefix)/share
    52 datarootdir = $(prefix)/share
    34 datadir = $(datarootdir)/dictd
    53 datadir = $(datarootdir)/dictd
    35 
    54 
    36 ################################################################
    55 ################################################################
    37 # Project files.
    56 # Project dirs/files.
    38 
    57 
    39 C5_FILES := $(wildcard *.dict-c5)
    58 C5_FILES := $(wildcard *.dict-c5)
    40 DICT_FILES := $(C5_FILES:.dict-c5=.dict)
    59 DICT_FILES := $(C5_FILES:.dict-c5=.dict)
    41 DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
    60 DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
    42 INDEX_FILES := $(C5_FILES:.dict-c5=.index)
    61 INDEX_FILES := $(C5_FILES:.dict-c5=.index)
       
    62 
       
    63 RST_FILES := $(wildcard *.rst)
       
    64 HTML_FILES := $(RST_FILES:.rst=.html)
    43 
    65 
    44 ################################################################
    66 ################################################################
    45 # Build targets.
    67 # Build targets.
    46 
    68 
    47 .PHONY: all
    69 .PHONY: all
    77 	for f in $(DICTDZ_FILES) $(INDEX_FILES); do \
    99 	for f in $(DICTDZ_FILES) $(INDEX_FILES); do \
    78 		rm -f $(datadir)/$$f; \
   100 		rm -f $(datadir)/$$f; \
    79 	done
   101 	done
    80 
   102 
    81 ################################################################
   103 ################################################################
       
   104 # Documentation targets.
       
   105 
       
   106 .PHONY: html
       
   107 html: $(HTML_FILES)
       
   108 
       
   109 $(HTML_FILES): %.html: %.rst
       
   110 	$(RST2HTML) --stylesheet=rst.css $*.rst $@
       
   111 
       
   112 ################################################################
    82 # Clean targets.
   113 # Clean targets.
    83 
   114 
    84 .PHONY: distclean
   115 .PHONY: distclean
    85 distclean: clean
   116 distclean: clean
    86 
   117 
    87 .PHONY: clean
   118 .PHONY: clean
    88 clean:
   119 clean:
    89 	rm -f $(DICTDZ_FILES) $(INDEX_FILES);
   120 	rm -f $(DICTDZ_FILES) $(INDEX_FILES)
    90 
   121 
    91 ################################################################
   122 ################################################################
    92 # Helper target.
   123 # Helper target.
    93 
   124 
    94 .PHONY: help
   125 .PHONY: help