-#
-# Makefile for the cc65 documentation
-#
-
-
-# Default for the compiler lib search path as compiler define
-
-SGML = apple2.sgml \
- ar65.sgml \
- atari.sgml \
- atmos.sgml \
- c128.sgml \
- c16.sgml \
- c64.sgml \
- ca65.sgml \
- ca65html.sgml \
- cbm610.sgml \
- cc65.sgml \
- cl65.sgml \
- co65.sgml \
- coding.sgml \
- da65.sgml \
- debugging.sgml \
- dio.sgml \
- funcref.sgml \
- geos.sgml \
- index.sgml \
- intro.sgml \
- ld65.sgml \
- library.sgml \
- lynx.sgml \
- nes.sgml \
- plus4.sgml \
- vic20.sgml
-
-TXT = $(SGML:.sgml=.txt)
-HTML = $(SGML:.sgml=.html)
-INFO = $(SGML:.sgml=.info)
-DVI = $(SGML:.sgml=.dvi)
-TEX = $(SGML:.sgml=.tex)
-
-# ------------------------------------------------------------------------------
-# Rules to make targets
-
-%.txt: %.sgml
- sgml2txt $<
-
-%.html: %.sgml
- sgml2html --split=1 $<
-
-%.info: %.sgml
- sgml2info $<
-
-%.dvi: %.sgml
- sgml2latex $<
-
-%.tex: %.sgml
- sgml2latex --output=tex $<
-
-# ------------------------------------------------------------------------------
-# Targets
-
-.PHONY: all
-all: txt html info dvi
-
-.PHONY: txt
-txt: $(TXT)
-
-.PHONY: html
-html: $(HTML)
-
-.PHONY: info
-info: $(INFO)
-
-.PHONY: dvi
-dvi: $(DVI)
-
-.PHONY: tex
-tex: $(TEX)
-
-# The index.html target is special, since it does not get splitted
-index.html: index.sgml
- sgml2html --split=0 $<
+ifneq ($(shell echo),)
+ CMD_EXE = 1
+endif
-clean:
- rm -f *~
+.PHONY: all mostlyclean clean install zip doc html info
+
+.SUFFIXES:
+
+htmldir = $(PREFIX)/share/doc/cc65$(DESTPACKAGE_SUFFIX)/html
+infodir = $(PREFIX)/share/info
+
+ifdef CMD_EXE
+
+doc clean install zip:
-zap: clean
- rm -f $(TXT) $(HTML) $(INFO) $(DVI) $(TEX) *.html *.info-* *.man
+else # CMD_EXE
-# ------------------------------------------------------------------------------
-# Special target rules
+SGMLS := $(wildcard *.sgml)
-coding.html: coding.sgml
- sgml2html --split=0 $<
+../html/coding.html ../html/index.html: \
+TOC_LEVEL = 0
-funcref.html: funcref.sgml
- sgml2html --split=2 $<
+TOC_LEVEL = 2
-index.html: index.sgml
- sgml2html --split=0 $<
+INSTALL = install
-# ------------------------------------------------------------------------------
-# Make the dependencies
+doc: html info
-.PHONY: depend dep
-depend dep: $(OBJS:.o=.c)
- @echo "Creating dependency information"
- $(CC) -MM $^ > .depend
+html: $(addprefix ../html/,$(SGMLS:.sgml=.html) doc.css doc.png)
+info: $(addprefix ../info/,$(SGMLS:.sgml=.info))
+../html ../info:
+ @mkdir $@
+
+../html/%.html: %.sgml header.html | ../html
+ @cd ../html && linuxdoc -B html -s 0 -T $(TOC_LEVEL) -H ../doc/header.html ../doc/$<
+
+../html/doc.%: doc.% | ../html
+ cp $< ../html
+
+../info/%.info: %.sgml | ../info
+ @cd ../info && linuxdoc -B info ../doc/$<
+
+clean:
+ $(RM) -r ../html ../info
+
+install:
+ $(if $(PREFIX),,$(error variable `PREFIX' must be set))
+ifeq ($(wildcard ../html),../html)
+ $(INSTALL) -d $(DESTDIR)$(htmldir)
+ $(INSTALL) -m0644 ../html/*.* $(DESTDIR)$(htmldir)
+endif
+ifeq ($(wildcard ../info),../info)
+ $(INSTALL) -d $(DESTDIR)$(infodir)
+ $(INSTALL) -m0644 ../info/*.* $(DESTDIR)$(infodir)
+endif
+
+zip:
+ifneq "$(wildcard ../html)" ""
+ @cd .. && zip cc65 html/*.*
+endif
+
+endif # CMD_EXE
+
+all mostlyclean: