Makefile
changeset 107 4cfb94e11b5d
parent 106 092b25d032af
child 108 1f1363141da7
equal deleted inserted replaced
106:092b25d032af 107:4cfb94e11b5d
    51 host_os = unix
    51 host_os = unix
    52 ifneq '' '$(COMSPEC)'
    52 ifneq '' '$(COMSPEC)'
    53   ifneq '' '$(WINDIR)'
    53   ifneq '' '$(WINDIR)'
    54     # Probably under Windows.
    54     # Probably under Windows.
    55     host_os = windows
    55     host_os = windows
       
    56     ifneq '' '$(wildcard /etc/setup/*cygwin*)'
       
    57       # Probably under Cygwin.
       
    58       host_os = cygwin
       
    59     endif
    56   endif
    60   endif
    57 endif
    61 endif
    58 
    62 
    59 ################################################################
    63 ################################################################
    60 # Build tool definition/switches.
    64 # Build tools definition/switches.
    61 
    65 
    62 RST2HTML = rst2html
    66 RST_WARNING_FLAGS := --halt warning
    63 ifeq '$(host_os)' 'windows'
    67 RST_FLAGS := --strip-comments
    64   RST2HTML = rst2html.py
    68 RST_FLAGS += $(RST_WARNING_FLAGS)
    65 endif
    69 
       
    70 RST2HTML := rst2html
       
    71 ifeq '$(host_os)' 'cygwin'
       
    72   RST2HTML := rst2html.py
       
    73 endif
       
    74 RST2HTML_FLAGS := $(RST_FLAGS)
    66 
    75 
    67 ################################################################
    76 ################################################################
    68 # Install paths.
    77 # Install paths.
    69 
    78 
    70 ifeq '$(origin prefix)' 'undefined'
    79 ifeq '$(origin prefix)' 'undefined'
    77 datarootdir = $(prefix)/share
    86 datarootdir = $(prefix)/share
    78 datadir = $(datarootdir)/dictd
    87 datadir = $(datarootdir)/dictd
    79 
    88 
    80 ################################################################
    89 ################################################################
    81 # Project dirs/files.
    90 # Project dirs/files.
       
    91 
       
    92 BUILD_SCRIPT := $(first-word $(MAKEFILE_LIST))
    82 
    93 
    83 C5_FILES := $(wildcard *.dict-c5)
    94 C5_FILES := $(wildcard *.dict-c5)
    84 DICT_FILES := $(C5_FILES:.dict-c5=.dict)
    95 DICT_FILES := $(C5_FILES:.dict-c5=.dict)
    85 DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
    96 DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
    86 INDEX_FILES := $(C5_FILES:.dict-c5=.index)
    97 INDEX_FILES := $(C5_FILES:.dict-c5=.index)
   172 
   183 
   173 .PHONY: html
   184 .PHONY: html
   174 html: $(HTML_FILES)
   185 html: $(HTML_FILES)
   175 
   186 
   176 $(HTML_FILES): %.html: %.rst
   187 $(HTML_FILES): %.html: %.rst
   177 	$(RST2HTML) --stylesheet=rst.css $*.rst $@
   188 	$(RST2HTML) $(RST2HTML_FLAGS) --stylesheet=rst.css $*.rst $@
   178 
   189 
   179 ################################################################
   190 ################################################################
   180 # Statistics targets.
   191 # Statistics targets.
   181 
   192 
   182 .PHONY: stat
   193 .PHONY: stat