+
+# Put user-supplied flags at the end, where they
+# have a chance of winning.
+CFLAGS += $(CFLAGS_EXTRA)
+
+.EXPORT_ALL_VARIABLES:
+
+all: applet_source_list busybox busybox.links doc
+
+applet_source_list: busybox.sh Config.h
+ (echo -n "APPLET_SOURCES := "; $(SHELL) $^ $(BB_SRC_DIR)) > $@
+
+doc: olddoc
+
+# Old Docs...
+olddoc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
+
+docs/busybox.pod : docs/busybox_header.pod usage.h docs/busybox_footer.pod
+ - ( cat docs/busybox_header.pod; \
+ docs/autodocifier.pl usage.h; \
+ cat docs/busybox_footer.pod ) > docs/busybox.pod
+
+docs/BusyBox.txt: docs/busybox.pod
+ @echo
+ @echo BusyBox Documentation
+ @echo
+ -mkdir -p docs
+ -pod2text $< > $@
+
+docs/BusyBox.1: docs/busybox.pod
+ - mkdir -p docs
+ - pod2man --center=BusyBox --release="version $(VERSION)" \
+ $< > $@
+
+docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html
+ - mkdir -p docs
+ -@ rm -f docs/BusyBox.html
+ -@ ln -s busybox.lineo.com/BusyBox.html docs/BusyBox.html
+
+docs/busybox.lineo.com/BusyBox.html: docs/busybox.pod
+ -@ mkdir -p docs/busybox.lineo.com
+ - pod2html --noindex $< > \
+ docs/busybox.lineo.com/BusyBox.html
+ -@ rm -f pod2html*
+
+
+# New docs based on DOCBOOK SGML
+newdoc: docs/busybox.txt docs/busybox.pdf docs/busybox/busyboxdocumentation.html
+
+docs/busybox.txt: docs/busybox.sgml
+ @echo
+ @echo BusyBox Documentation
+ @echo
+ - mkdir -p docs
+ (cd docs; sgmltools -b txt busybox.sgml)
+
+docs/busybox.dvi: docs/busybox.sgml
+ - mkdir -p docs
+ (cd docs; sgmltools -b dvi busybox.sgml)
+
+docs/busybox.ps: docs/busybox.sgml
+ - mkdir -p docs
+ (cd docs; sgmltools -b ps busybox.sgml)
+
+docs/busybox.pdf: docs/busybox.ps
+ - mkdir -p docs
+ (cd docs; ps2pdf busybox.ps)
+
+docs/busybox/busyboxdocumentation.html: docs/busybox.sgml
+ - mkdir -p docs
+ (cd docs/busybox.lineo.com; sgmltools -b html ../busybox.sgml)
+
+
+busybox: $(PWD_LIB) $(LIBBB_LIB) $(OBJECTS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(PWD_LIB) $(LIBBB_LIB) $(LIBRARIES)