From c0d92ef56616f395bec937703de9d8c1d25542a1 Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Wed, 7 Feb 2018 16:27:36 -0800 Subject: [PATCH] [flang] Clean up Makefile, add reformat target. Now the only targets in Makefile are Debug, Release, and reformat. "make reformat" reformats all C++ source in place. Also includes the result of "make reformat". Most of the changes were just moving the "main" include up. Original-commit: flang-compiler/f18@cf7d3a7afb650b5fc952894136dd18e5551ac578 --- flang/Makefile | 70 +++++----------------------------------- flang/lib/parser/parse-tree.cc | 2 +- flang/lib/parser/preprocessor.cc | 2 +- flang/lib/parser/prescan.cc | 2 +- flang/lib/parser/source.cc | 2 +- flang/lib/semantics/type.cc | 1 - 6 files changed, 12 insertions(+), 67 deletions(-) diff --git a/flang/Makefile b/flang/Makefile index c575021..02da868 100644 --- a/flang/Makefile +++ b/flang/Makefile @@ -1,68 +1,14 @@ -CXX=g++ -CXXFLAGS=-Wall -std=c++17 -O2 -# CXXFLAGS=-Wall -std=c++17 -g - -# CXX=/proj/pgi/linux86-64/dev/bin/pgc++ -# CXXFLAGS=-std=c++17 - -SRCS=f2018-demo.cc char-buffer.cc idioms.cc message.cc \ - parse-tree.cc position.cc preprocessor.cc prescan.cc source.cc -RELS=$(SRCS:.cc=.o) - -f18: $(RELS) - $(CXX) -o $@ $(RELS) -clean: - rm -f *.o core.* perf.data* out -clobber: clean - rm -f f18 *~ -backup: clean - (cd ../..; tar czf ~/save/f18.tgz.`date '+%m-%d-%y'` .) - (cd ../..; tar czf /local/home/save/f18.tgz.`date '+%m-%d-%y'` .) - -f2018-demo.o: basic-parsers.h char-buffer.h cooked-chars.h \ - grammar.h idioms.h parse-tree.h prescan.h source.h user-state.h -char-buffer.o: char-buffer.h idioms.h -idioms.o: idioms.h -message.o: message.h -parse-tree.o: parse-tree.h idioms.h indirection.h -preprocessor.o: preprocessor.h idioms.h -prescan.o: prescan.h char-buffer.h idioms.h source.h -position.o: position.h -source.o: source.h char-buffer.h idioms.h - -basic-parsers.h: idioms.h message.h parse-state.h position.h - @touch $@ -char-parsers.h: basic-parsers.h parse-state.h - @touch $@ -cooked-chars.h: basic-parsers.h char-parsers.h idioms.h parse-state.h - @touch $@ -cooked-tokens.h: basic-parsers.h cooked-chars.h idioms.h position.h - @touch $@ -debug-parser.h: basic-parsers.h parse-state.h - @touch $@ -prescan.h: char-buffer.h preprocessor.h source.h - @touch $@ -grammar.h: basic-parsers.h cooked-chars.h cooked-tokens.h \ - format-specification.h parse-tree.h user-state.h - @touch $@ -message.h: position.h - @touch $@ -parse-state.h: message.h position.h - @touch $@ -parse-tree.h: format-specification.h idioms.h indirection.h position.h - @touch $@ - - CLANG_FORMAT=/proj/pgi/flang/x86_64/flang-dev/bin/clang-format -formatted: - @mkdir -p formatted - @for x in *.h *.cc; do \ - $(CLANG_FORMAT) < $$x > formatted/$$x; \ - done - -.PHONY: formatted Debug Release: @mkdir -p $@ cd $@ && cmake -DCMAKE_BUILD_TYPE=$@ .. && make .PHONY: Debug Release + +reformat: + @find . -regextype posix-extended -regex '.*\.(h|cc)' \ + | while read file; do \ + echo $$file; \ + $(CLANG_FORMAT) -i $$file; \ + done +.PHONY: reformat diff --git a/flang/lib/parser/parse-tree.cc b/flang/lib/parser/parse-tree.cc index 4497a62..c082ca0 100644 --- a/flang/lib/parser/parse-tree.cc +++ b/flang/lib/parser/parse-tree.cc @@ -1,6 +1,6 @@ +#include "parse-tree.h" #include "idioms.h" #include "indirection.h" -#include "parse-tree.h" #include namespace Fortran { diff --git a/flang/lib/parser/preprocessor.cc b/flang/lib/parser/preprocessor.cc index ebf5f65..c94e00b 100644 --- a/flang/lib/parser/preprocessor.cc +++ b/flang/lib/parser/preprocessor.cc @@ -1,6 +1,6 @@ +#include "preprocessor.h" #include "char-buffer.h" #include "idioms.h" -#include "preprocessor.h" #include "prescan.h" #include #include diff --git a/flang/lib/parser/prescan.cc b/flang/lib/parser/prescan.cc index efe4a58..4066750 100644 --- a/flang/lib/parser/prescan.cc +++ b/flang/lib/parser/prescan.cc @@ -1,6 +1,6 @@ +#include "prescan.h" #include "char-buffer.h" #include "idioms.h" -#include "prescan.h" #include "source.h" #include #include diff --git a/flang/lib/parser/source.cc b/flang/lib/parser/source.cc index 635f44a..77bd35f 100644 --- a/flang/lib/parser/source.cc +++ b/flang/lib/parser/source.cc @@ -1,6 +1,6 @@ +#include "source.h" #include "char-buffer.h" #include "idioms.h" -#include "source.h" #include #include #include diff --git a/flang/lib/semantics/type.cc b/flang/lib/semantics/type.cc index 55c7050..9a9ed73 100644 --- a/flang/lib/semantics/type.cc +++ b/flang/lib/semantics/type.cc @@ -1,5 +1,4 @@ #include "type.h" - #include "attr.h" #include -- 2.7.4