summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbwarken <bwarken>2013-04-28 01:28:07 +0000
committerbwarken <bwarken>2013-04-28 01:28:07 +0000
commit99fc5bfc992eb56491c2750eb4a2503d1a7e93a8 (patch)
tree7315a4d38d20928c2b198515ef7c8c49bc05e284 /src
parent577bd0202826b8f8b1bf04c09d0a48b74adeb799 (diff)
downloadgroff-99fc5bfc992eb56491c2750eb4a2503d1a7e93a8.tar.gz
src/roff/groff/Makefile.sub: Use `make' variables to get
`groff' options from `getopt' in `groff.cpp'. Create 2 files `groff_opts_no_arg.txt' and `groff_opts_with_arg.txt'.
Diffstat (limited to 'src')
-rw-r--r--src/roff/groff/Makefile.sub50
1 files changed, 38 insertions, 12 deletions
diff --git a/src/roff/groff/Makefile.sub b/src/roff/groff/Makefile.sub
index 8fd89cdb..f345c642 100644
--- a/src/roff/groff/Makefile.sub
+++ b/src/roff/groff/Makefile.sub
@@ -5,7 +5,7 @@
# Copyright (C) 1993-2013
# Free Software Foundation, Inc.
-# Last update: 26 Apr 2013
+# Last update: 28 Apr 2013
# `groff' is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -31,26 +31,52 @@ CCSRCS=$(srcdir)/groff.cpp
CSRCS=$(srcdir)/pipeline.c
HDRS=$(srcdir)/pipeline.h
-MOSTLYCLEANADD=groff_options.txt
+GROFF_OPTS_OUTPUT := groff_opts_no_arg.txt \
+ groff_opts_with_arg.txt
+
+MOSTLYCLEANADD := $(GROFF_OPTS_OUTPUT)
RM=rm -f
-all: groff_options.txt
+OPTS := $(shell $(EGREP) -e ':.*:.*:' groff.cpp \
+ | sed -e 's/[ \t",]//g')
+
+OPTS_NO_ARG := $(shell echo $(OPTS) \
+ | sed -e 's/[a-zA-Z]://g')
+
+OPTS_WITH_ARG := $(shell echo $(OPTS) \
+ | sed "s/[$(OPTS_NO_ARG):]//g")
+
+show:
+ @echo opts: $(OPTS)
+ @echo no: $(OPTS_NO_ARG)
+ @echo optarg: $(OPTS_WITH_ARG)
+
+.PHONY: all
+all: groff.cpp $(GROFF_OPTS_OUTPUT)
+
+groff_opts_no_arg.txt:
+ $(RM) $@
+ echo $(OPTS_NO_ARG) > $@
-groff_options.txt: groff.cpp
- $(EGREP) -A2 -e 'getopt' $< \
- | sed -n -e '/"/p' \
- | sed -e 's/^[^"\]*"//' \
- | sed -e 's/"[^"]*$$//' > $@
+groff_opts_with_arg.txt:
+ $(RM) $@
+ echo $(OPTS_WITH_ARG) > $@
-install_data: groff_options.txt
+.PHONY: install_data
+install_data: $(GROFF_OPTS_OUTPUT)
-test -d $(DESTDIR)$(libprogramdir) \
|| $(mkinstalldirs) $(DESTDIR)$(libprogramdir)
- $(RM) $(DESTDIR)$(libprogramdir)/$<
- $(INSTALL_SCRIPT) $< $(DESTDIR)$(libprogramdir)
+ for f in $(GROFF_OPTS_OUTPUT); do \
+ $(RM) $(DESTDIR)$(libprogramdir)/$$f; \
+ $(INSTALL_SCRIPT) $$f $(DESTDIR)$(libprogramdir); \
+ done
+.PHONY: uninstall_data
uninstall_sub:
- $(RM) $(DESTDIR)$(libprogramdir)/groff_options.txt
+ for f in $(GROFF_OPTS_OUTPUT); do \
+ $(RM) $(DESTDIR)$(libprogramdir)/$$f; \
+ done
-test -d $(DESTDIR)$(libprogramdir) \
&& -rmdir $(DESTDIR)$(libprogramdir)