summaryrefslogtreecommitdiff
path: root/real.make
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-12-06 14:15:43 -0800
committerBen Longbons <b.r.longbons@gmail.com>2013-12-06 14:15:49 -0800
commit3eea219548e84efdbc3148ce378fcba865f97a01 (patch)
tree6ece594f60ddff038cf9c1d94b99d8d66a00bc20 /real.make
parent1458563f00deebbbcf3e8049dc90157fb825fae3 (diff)
downloadtmwa-3eea219548e84efdbc3148ce378fcba865f97a01.tar.gz
tmwa-3eea219548e84efdbc3148ce378fcba865f97a01.tar.bz2
tmwa-3eea219548e84efdbc3148ce378fcba865f97a01.tar.xz
tmwa-3eea219548e84efdbc3148ce378fcba865f97a01.zip
Add basic source formatting tools
Diffstat (limited to 'real.make')
-rw-r--r--real.make26
1 files changed, 10 insertions, 16 deletions
diff --git a/real.make b/real.make
index 72957ce..3ae013b 100644
--- a/real.make
+++ b/real.make
@@ -106,6 +106,8 @@ endif
include Makefile # for variables - this is handled VERY carefully
+export PATH:=$(realpath ${SRC_DIR}/tools):${PATH}
+
# bash is needed for 'set -o pipefail' below - I have had real bugs there!
# It's just not worth the bother to see if another shell works when it
# needs to *and* fails when it needs to. Just use bash.
@@ -245,7 +247,7 @@ obj/%.d: src/%.cpp
set -o pipefail; \
${CXX} ${CPPFLAGS} -DGENERATING_DEPENDENCIES ${CXXFLAGS} -MG -MP -MM $< \
-MT '$(patsubst %.d,%.ii,$@) $(patsubst %.d,%.ll,$@) $(patsubst %.d,%.bc,$@) $(patsubst %.d,%.s,$@) $(patsubst %.d,%.o,$@) $@' \
- | sed -e ':again; s:/[^/ ]*/\.\./:/:; t again' \
+ | sed -e ':again; s:/[^/. ]*/\.\./:/:; t again' \
-e 's: ${SRC_DIR}/: :g' \
> $@
endif
@@ -348,27 +350,15 @@ include ${SRC_DIR}/version.make
# This is complicated and still isn't optimal.
conf-raw/int-%.h: FORCE
$(MKDIR_FIRST)
- @grep -s -q '^$(value $*)$$' $@ \
- || { \
- echo "#define $* \\"; \
- echo '$(value $*)'; \
- } > $@
+ echo '#define $* $(value $*)' | maybe-replace $@
bool_yes := true
bool_no := false
conf-raw/bool-%.h: FORCE
$(MKDIR_FIRST)
- @grep -s -q '^$(bool_$(value $*))$$' $@ \
- || { \
- echo "#define $* \\"; \
- echo '$(bool_$(value $*))'; \
- } > $@
+ echo '#define $* $(bool_$(value $*))' | maybe-replace $@
conf-raw/str-%.h: FORCE
$(MKDIR_FIRST)
- @grep -s -q '^"$(value $*)"$$' $@ \
- || { \
- echo "#define $* \\"; \
- echo '"$(value $*)"'; \
- } > $@
+ echo '#define $* "$(value $*)"' | maybe-replace $@
FORCE: ;
override CPPFLAGS += -I .
@@ -393,3 +383,7 @@ dist/%-bundled.tar: dist/%-src.tar dist/%-attoconf-only.tar
dist: dist/tmwa-${VERSION_FULL}-src.tar dist/tmwa-${VERSION_FULL}-bundled.tar
.PHONY: dist
+
+format:
+ cd ${SRC_DIR} && apply-filter 'pp-indent | bs-align' ${REAL_SOURCES} ${REAL_HEADERS} ${LEXERS} ${PARSERS}
+.PHONY: format