1 | #-----[ Directory ]---------------------------------------------------- |
---|
2 | DIR_LIB = Library |
---|
3 | |
---|
4 | #-----[ Usual Commands ]----------------------------------------------- |
---|
5 | |
---|
6 | RM = rm |
---|
7 | ECHO = echo -e |
---|
8 | CD = cd |
---|
9 | LS = ls |
---|
10 | PWD = `pwd` |
---|
11 | TEST = test |
---|
12 | MAKE = make -s |
---|
13 | BASENAME = basename |
---|
14 | CAT = cat |
---|
15 | MKDIR = mkdir |
---|
16 | |
---|
17 | #-----[ Particular Commands ]------------------------------------------ |
---|
18 | |
---|
19 | #-----[ Options ]------------------------------------------------------ |
---|
20 | DIR_DOC = Documentation/Source |
---|
21 | |
---|
22 | PREFIXE_PATH = "." |
---|
23 | SUFFIXE_PATH = ".txt" |
---|
24 | |
---|
25 | #-----[ Rules ]-------------------------------------------------------- |
---|
26 | .PHONY : all help |
---|
27 | |
---|
28 | all : help |
---|
29 | |
---|
30 | doc : |
---|
31 | @$(ECHO) "" |
---|
32 | @$(ECHO) "=====[ doc ]=====================================" |
---|
33 | @$(ECHO) "" |
---|
34 | @$(MAKE) -C $(DIR_DOC) view |
---|
35 | |
---|
36 | path : |
---|
37 | @$(ECHO) "" |
---|
38 | @$(ECHO) "=====[ path ]====================================" |
---|
39 | @$(ECHO) ""; |
---|
40 | @$(ECHO) -n "+ "; |
---|
41 | @$(BASENAME) $(PWD); |
---|
42 | @$(ECHO) "| <Top Level>"; |
---|
43 | @$(ECHO) "|"; |
---|
44 | @$(MAKE) path_rec TAB="| " DIR_PATH=. |
---|
45 | |
---|
46 | path_rec : |
---|
47 | @ \ |
---|
48 | \ |
---|
49 | for files in `$(LS) $(DIR_PATH)`; do \ |
---|
50 | if $(TEST) -d $(DIR_PATH)/$$files; \ |
---|
51 | then \ |
---|
52 | $(ECHO) "$(TAB)+ $$files"; \ |
---|
53 | \ |
---|
54 | if test -f $(DIR_PATH)/$(PREFIXE_PATH)`$(BASENAME) $$files`$(SUFFIXE_PATH); \ |
---|
55 | then \ |
---|
56 | $(ECHO) "$(TAB)| <\c"; \ |
---|
57 | $(CAT) $(DIR_PATH)/$(PREFIXE_PATH)`$(BASENAME) $$files`$(SUFFIXE_PATH); \ |
---|
58 | $(ECHO) ">"; \ |
---|
59 | else \ |
---|
60 | $(ECHO) "$(TAB)| <No description>"; \ |
---|
61 | fi; \ |
---|
62 | $(ECHO) "$(TAB)|"; \ |
---|
63 | \ |
---|
64 | $(MAKE) path_rec TAB="$(TAB)| " DIR_PATH=$(DIR_PATH)/$$files; \ |
---|
65 | fi; \ |
---|
66 | done; |
---|
67 | |
---|
68 | #~~~~~[ Lib ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
69 | |
---|
70 | lib : |
---|
71 | @$(ECHO) "" |
---|
72 | @$(ECHO) "=====[ lib ]=====================================" |
---|
73 | @$(ECHO) "" |
---|
74 | @$(ECHO) " Function unimplemented" |
---|
75 | @$(ECHO) "" |
---|
76 | @$(ECHO) " The library is generate into the directory : $(PWD)/$(DIR_LIB)" |
---|
77 | |
---|
78 | #~~~~~[ Maintenance ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
79 | |
---|
80 | clean : |
---|
81 | @$(ECHO) "" |
---|
82 | @$(ECHO) "=====[ clean ]===================================" |
---|
83 | @$(ECHO) "" |
---|
84 | @$(ECHO) "Delete temporary files "$(PWD) |
---|
85 | @$(MAKE) clean_rec DIR_CLEAN=. |
---|
86 | |
---|
87 | #Clean recursive |
---|
88 | clean_rec : |
---|
89 | @$(ECHO) "Delete temporary files in directory $(DIR_CLEAN)" |
---|
90 | @$(RM) -f $(DIR_CLEAN)/*~ |
---|
91 | @ \ |
---|
92 | if $(TEST) -f $(DIR_CLEAN)/Makefile -a "$(DIR_CLEAN)" != "."; \ |
---|
93 | then \ |
---|
94 | ($(CD) $(DIR_CLEAN); $(MAKE) clean;) \ |
---|
95 | else \ |
---|
96 | for files in `$(LS) $(DIR_CLEAN)`; do \ |
---|
97 | if $(TEST) -d $(DIR_CLEAN)/$$files; \ |
---|
98 | then \ |
---|
99 | $(MAKE) clean_rec DIR_CLEAN=$(DIR_CLEAN)/$$files; \ |
---|
100 | fi; \ |
---|
101 | done; \ |
---|
102 | fi; |
---|
103 | |
---|
104 | #~~~~~[ Help ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
105 | |
---|
106 | help : |
---|
107 | @$(ECHO) "" |
---|
108 | @$(ECHO) "=====[ help ]====================================" |
---|
109 | @$(ECHO) "" |
---|
110 | @$(ECHO) " Rules Description" |
---|
111 | @$(ECHO) "" |
---|
112 | @$(ECHO) " all cf rule \"help\"" |
---|
113 | @$(ECHO) " clean Delete temporary files" |
---|
114 | @$(ECHO) " doc View documentation files" |
---|
115 | @$(ECHO) " lib Generate the library to include" |
---|
116 | @$(ECHO) " help Print this message" |
---|
117 | @$(ECHO) " path Print a little description of each directory" |
---|
118 | @$(ECHO) "" |
---|
119 | |
---|