1 | |
---|
2 | MENUS_TGT = $(ARBHOME)/lib/gde/arb.menu |
---|
3 | MENUS_SRC = ARB_GDEmenus.source |
---|
4 | |
---|
5 | SED:=$(ARBHOME)/SH/arb_sed |
---|
6 | |
---|
7 | HELPFILELIST=helpfiles.lst |
---|
8 | GENHELPDEST=./HELP_GEN |
---|
9 | GENDOCDEST=./HELP_DOC_GEN |
---|
10 | |
---|
11 | SUBMENUS=$(wildcard MENUS/*.menu) |
---|
12 | GENMENUS=$(SUBMENUS:.menu=.genmenu) |
---|
13 | |
---|
14 | PPP:=./pp.pl |
---|
15 | CLEAN:=./cleanmenu.pl |
---|
16 | |
---|
17 | # ---------------------------------------- help for refactoring |
---|
18 | MENUS_EXPECTED = ARB_GDEmenus.expected |
---|
19 | |
---|
20 | # check expected result (to avoid unwanted changes) |
---|
21 | # call 'make update_expected' to expect the current result |
---|
22 | |
---|
23 | #CHECK_AS_EXPECTED = check_as_expected |
---|
24 | CHECK_AS_EXPECTED = |
---|
25 | |
---|
26 | # ---------------------------------------- |
---|
27 | |
---|
28 | all: $(MENUS_TGT) help $(CHECK_AS_EXPECTED) rm_obsolete |
---|
29 | |
---|
30 | MENUS/%.genmenu : genmenu.header |
---|
31 | |
---|
32 | MENUS/%.genmenu : MENUS/%.menu |
---|
33 | ( cat genmenu.header; $(SED) -e "s/^[ ]*//" ) < $< > $@ |
---|
34 | |
---|
35 | MENUS_DIRTY=ARB_GDEmenus.dirty |
---|
36 | |
---|
37 | $(MENUS_DIRTY) : $(MENUS_SRC) $(GENMENUS) Makefile $(PPP) |
---|
38 | $(PPP) -IMENUS $(MENUS_SRC) >$@ |
---|
39 | |
---|
40 | $(MENUS_TGT) : $(MENUS_DIRTY) $(CLEAN) |
---|
41 | chmod a+w $@ || true |
---|
42 | $(CLEAN) <$(MENUS_DIRTY) >$@ |
---|
43 | rm $(MENUS_DIRTY) |
---|
44 | chmod a-w $@ |
---|
45 | |
---|
46 | # ------------------------------------------------------------ |
---|
47 | |
---|
48 | update_expected: $(MENUS_TGT) |
---|
49 | cp $(MENUS_TGT) $(MENUS_EXPECTED) |
---|
50 | |
---|
51 | check_as_expected: $(MENUS_TGT) $(MENUS_EXPECTED) |
---|
52 | diff --unified --ignore-space-change --ignore-blank-lines $(MENUS_EXPECTED) $(MENUS_TGT) |
---|
53 | |
---|
54 | # ------------------------------------------------------------ |
---|
55 | |
---|
56 | help: $(HELPFILELIST) |
---|
57 | @test -d $(GENHELPDEST) || mkdir $(GENHELPDEST) |
---|
58 | @test -d $(GENDOCDEST) || mkdir $(GENDOCDEST) |
---|
59 | @$(MAKE) -f Makefile.helpfiles "GENHELPDEST=$(GENHELPDEST)" "GENDOCDEST=$(GENDOCDEST)" "HELPFILELIST=$(HELPFILELIST)" |
---|
60 | |
---|
61 | $(HELPFILELIST): $(SUBMENUS) Makefile |
---|
62 | grep -ih '^itemhelp:' $(SUBMENUS) | $(SED) -e 's/^itemhelp://' | sort | uniq > $@ |
---|
63 | |
---|
64 | # ------------------------------------------------------------ |
---|
65 | |
---|
66 | rm_obsolete: |
---|
67 | @(test -f ARB_GDEmenus && rm -f ARB_GDEmenus) || true |
---|
68 | |
---|
69 | clean: $(HELPFILELIST) |
---|
70 | @$(MAKE) -f Makefile.helpfiles \ |
---|
71 | "GENHELPDEST=$(GENHELPDEST)" \ |
---|
72 | "GENDOCDEST=$(GENDOCDEST)" \ |
---|
73 | "HELPFILELIST=$(HELPFILELIST)" \ |
---|
74 | clean |
---|
75 | rm -f $(GENMENUS) $(MENUS_TGT) $(HELPFILELIST) |
---|
76 | |
---|