From 99fc5bfc992eb56491c2750eb4a2503d1a7e93a8 Mon Sep 17 00:00:00 2001 From: bwarken Date: Sun, 28 Apr 2013 01:28:07 +0000 Subject: 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'. --- src/roff/groff/Makefile.sub | 50 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 12 deletions(-) (limited to 'src') 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) -- cgit v1.2.1