[flang] Clean up Makefile, add reformat target.
authorTim Keith <tkeith@nvidia.com>
Thu, 8 Feb 2018 00:27:36 +0000 (16:27 -0800)
committerTim Keith <tkeith@nvidia.com>
Thu, 8 Feb 2018 00:27:36 +0000 (16:27 -0800)
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
flang/lib/parser/parse-tree.cc
flang/lib/parser/preprocessor.cc
flang/lib/parser/prescan.cc
flang/lib/parser/source.cc
flang/lib/semantics/type.cc

index c575021..02da868 100644 (file)
@@ -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
index 4497a62..c082ca0 100644 (file)
@@ -1,6 +1,6 @@
+#include "parse-tree.h"
 #include "idioms.h"
 #include "indirection.h"
-#include "parse-tree.h"
 #include <algorithm>
 
 namespace Fortran {
index ebf5f65..c94e00b 100644 (file)
@@ -1,6 +1,6 @@
+#include "preprocessor.h"
 #include "char-buffer.h"
 #include "idioms.h"
-#include "preprocessor.h"
 #include "prescan.h"
 #include <algorithm>
 #include <cctype>
index efe4a58..4066750 100644 (file)
@@ -1,6 +1,6 @@
+#include "prescan.h"
 #include "char-buffer.h"
 #include "idioms.h"
-#include "prescan.h"
 #include "source.h"
 #include <cctype>
 #include <cstring>
index 635f44a..77bd35f 100644 (file)
@@ -1,6 +1,6 @@
+#include "source.h"
 #include "char-buffer.h"
 #include "idioms.h"
-#include "source.h"
 #include <algorithm>
 #include <cerrno>
 #include <cstring>
index 55c7050..9a9ed73 100644 (file)
@@ -1,5 +1,4 @@
 #include "type.h"
-
 #include "attr.h"
 #include <iostream>