@@ -7,28 +7,64 @@ DIRS=$(sort $(DIRS_UNSORTED))
77# # print sorted DIRS
88# $(info $$(DIRS) is [${DIRS}])
99
10- include vars .mk
10+ include constants .mk
1111
1212LOWDOWN_PATH =./lowdown
1313CSS_PATH =style.css
1414OBJS = build.sh README.md style.css style.css.map index.html
1515
16- build : clean script README index.html fix_index.html
16+ MAKE =make --no-print-directory
17+
18+ .PHONY : build
19+ build :
20+ @$(MAKE ) clean
21+ @$(MAKE ) script_wrapper
22+ @$(MAKE ) README
23+ @$(MAKE ) index.html
24+ @$(MAKE ) fix_index.html
1725 @echo -e " $( COLOR_GREEN) DONE$( COLOR_NONE) "
1826
27+ .PHONY : clean
1928clean :
2029 @echo -e " $( COLOR_YELLOW) Deleting$( COLOR_NONE) pre-existing (if any) files $( COLOR_BLUE) $( OBJS) $( COLOR_NONE) "
2130 @rm -f $(OBJS )
2231
32+ # # create dir-specific temporary makefiles
33+ .PHONY : gen_temp_mk
34+ gen_temp_mk :
35+ @for dirname in $(DIRS ) ; do \
36+ echo " # AUTOGENERATED!! DO NOT EDIT" > $$ {dirname}/$$ {dirname}.mk; \
37+ echo " include ../constants.mk" >> $$ {dirname}/$$ {dirname}.mk; \
38+ echo " include ../common.mk" >> $$ {dirname}/$$ {dirname}.mk; \
39+ done
40+
41+ # # remove dir-specific temporary makefiles
42+ .PHONY : clean_temp_mk
43+ clean_temp_mk :
44+ @for dirname in $(DIRS ) ; do \
45+ rm -f $$ {dirname}/$$ {dirname}.mk; \
46+ done
47+
48+ # # create main build shell script which calls all the dir-specific temporary makefiles
49+ .PHONY : script
2350script :
2451 @echo -e " $( COLOR_YELLOW) Generating$( COLOR_NONE) script file $( COLOR_BLUE) build.sh$( COLOR_NONE) "
2552 @echo " # AUTOGENERATED!! DO NOT EDIT" > build.sh
53+
2654 @for dirname in $(DIRS ) ; do \
27- echo " make -C $$ {dirname} -f $$ {dirname}.mk --no-print-directory" >> build.sh ; \
55+ echo " make NOTE_NAME= $$ {dirname}_notes -C $$ {dirname} -f $$ {dirname}.mk --no-print-directory" >> build.sh ; \
2856 done
57+
2958 @chmod +x build.sh
3059 @./build.sh
3160
61+ .PHONY : script_wrapper
62+ script_wrapper :
63+ @$(MAKE ) clean_temp_mk
64+ @$(MAKE ) gen_temp_mk
65+ @$(MAKE ) script
66+
67+ .PHONY : README
3268README :
3369 @echo -e " $( COLOR_YELLOW) Generating$( COLOR_NONE) README file $( COLOR_BLUE) README.md$( COLOR_NONE) "
3470 @echo ' # devpogi notes' > README.md
@@ -51,6 +87,7 @@ index.html: README.md style.css
5187 @rm -f $@ .temp
5288 @echo -e " generated $( COLOR_BLUE) index.html$( COLOR_NONE) "
5389
90+ .PHONY : fix_index.html
5491fix_index.html :
5592 @sed -i ' s/.md/.html/g' index.html
5693
0 commit comments