[ae0f92]: misc / uncrustify.mk Maximize Restore History

Download this file

uncrustify.mk    64 lines (45 with data), 2.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
SUBDIRS += .
SUBDIRS += include include/stxxl include/stxxl/bits
SUBDIRS += $(foreach d, algo common containers containers/btree io mng stream utils, include/stxxl/bits/$d)
SUBDIRS += algo common containers containers/btree io mng stream utils
FILES_IGNORE := ./doxymain.h
FILES := $(filter-out $(FILES_IGNORE),$(wildcard $(foreach d, $(SUBDIRS), $d/*.h $d/*.cpp)))
FILES += $(foreach h, algorithm all deque io ksort mallocstats map mng priority_queue queue random scan sort stable_ksort stack stream timer vector, include/stxxl/$h)
all: uncrustify-test
all: uncrustify-diff
uncrustify-test: $(FILES:=.uncrustify)
uncrustify-diff: $(FILES:=.diff)
uncrustify-apply: $(FILES:=.unc-apply)
viewdiff:
view $(wildcard $(foreach d, $(SUBDIRS), $d/*.diff))
clean:
$(RM) $(FILES:=.uncrustify) $(FILES:=.uncrustifyT) $(FILES:=.diff)
$(RM) $(UNCRUSTIFY_CFG)-file-header
.SECONDARY:
############################################################################
#UNCRUSTIFY ?= ./uncrustify
UNCRUSTIFY ?= uncrustify
UNCRUSTIFY_CFG ?= misc/uncrustify.cfg
UNCRUSTIFY_FLAGS+= -c $(UNCRUSTIFY_CFG) -l CPP
%.diff: % %.uncrustify
@test -f $*
@test -f $*.uncrustify
diff -u $^ > $@ || test $$? == 1
test -s $@ || $(RM) $@
%.uncrustify: % $(UNCRUSTIFY_CFG) #$(UNCRUSTIFY)
$(RM) $<.diff
$(UNCRUSTIFY) $(UNCRUSTIFY_FLAGS) -o $@T < $<
mv $@T $@
%.unc-apply: %.uncrustify
cmp -s $* $*.uncrustify || cp $*.uncrustify $*
update-uncrustify-cfg:
$(UNCRUSTIFY) -c $(UNCRUSTIFY_CFG) --update-config-with-doc | \
sed -e '/indent_access_spec/s/-[0-9][0-9]*/-indent_columns/' > $(UNCRUSTIFY_CFG).tmp
cmp -s $(UNCRUSTIFY_CFG).tmp $(UNCRUSTIFY_CFG) || cp -p $(UNCRUSTIFY_CFG) $(UNCRUSTIFY_CFG).old
cmp -s $(UNCRUSTIFY_CFG).tmp $(UNCRUSTIFY_CFG) || cp $(UNCRUSTIFY_CFG).tmp $(UNCRUSTIFY_CFG)
$(RM) $(UNCRUSTIFY_CFG).tmp
uncrustify-file-header: $(UNCRUSTIFY_CFG)-file-header
$(MAKE) -f $(lastword $(MAKEFILE_LIST)) uncrustify-test uncrustify-diff UNCRUSTIFY_CFG=$(UNCRUSTIFY_CFG)-file-header
$(UNCRUSTIFY_CFG)-file-header: $(UNCRUSTIFY_CFG)
sed -e '/cmt_insert_file_header/s/""/misc\/fileheader.txt/' $< > $@
.PHONY: all clean viewdiff uncrustify-test uncrustify-diff uncrustify-apply update-uncrustify-cfg