1 | # main makefile |
---|
2 | |
---|
3 | # ****************************** |
---|
4 | # * Local variables |
---|
5 | # ****************************** |
---|
6 | CUR_DIR=$(shell pwd) |
---|
7 | SRC_DIR=$(CUR_DIR)/src |
---|
8 | OUTPUT_DIR=$(CUR_DIR)/output |
---|
9 | |
---|
10 | # ****************************** |
---|
11 | # * Global for make globals |
---|
12 | # ****************************** |
---|
13 | |
---|
14 | export UTT_DIR=${OUTPUT_DIR} |
---|
15 | |
---|
16 | # executables |
---|
17 | export UTT_BIN_DIR=${UTT_DIR}/bin |
---|
18 | # configuration files |
---|
19 | export UTT_CONF_DIR=${UTT_DIR}/etc/utt |
---|
20 | # language/encoding specific stuff |
---|
21 | # any extra files for some programs, like: weights.kor, cats.dgc, gram.dgc, etc. |
---|
22 | export UTT_LANG_DIR=${UTT_DIR}/share/utt |
---|
23 | # some files like ser.l.template, terms.m4 |
---|
24 | export UTT_LIB_DIR=${UTT_DIR}/lib/utt |
---|
25 | # stuff like documantation (man, info), docs: FAQ, COPYRIGHT, NEWS, README |
---|
26 | export UTT_SHARE_DIR=${UTT_DIR}/share |
---|
27 | |
---|
28 | ############################## |
---|
29 | |
---|
30 | # list of components to be included in the distribution |
---|
31 | COMPONENTS = compiledic cor dgp fla gph grp gue kon kor kot lem mar rm12 rs12 sen-l sen-nl ser tags tok.l unfla |
---|
32 | |
---|
33 | ############################## |
---|
34 | |
---|
35 | # ------------------------------------------------------------------ |
---|
36 | # sekcja kompilacji (kompiluje i wgrywa do OUTPUT_DIR) |
---|
37 | # ------------------------------------------------------------------ |
---|
38 | .PHONY: compile |
---|
39 | compile: dirs components |
---|
40 | @echo "Make compiled successfully!" |
---|
41 | |
---|
42 | .PHONY: dirs |
---|
43 | dirs: |
---|
44 | if [ -d ${UTT_DIR} ]; then rm -r ${UTT_DIR}; fi |
---|
45 | mkdir -p ${UTT_DIR} |
---|
46 | mkdir -p ${UTT_BIN_DIR} |
---|
47 | mkdir -p ${UTT_CONF_DIR} |
---|
48 | mkdir -p ${UTT_LANG_DIR} |
---|
49 | mkdir -p ${UTT_LIB_DIR} |
---|
50 | mkdir -p ${UTT_SHARE_DIR}/utt |
---|
51 | mkdir -p ${UTT_SHARE_DIR}/doc/utt |
---|
52 | mkdir -p ${UTT_SHARE_DIR}/info |
---|
53 | mkdir -p ${UTT_SHARE_DIR}/man/man3 |
---|
54 | |
---|
55 | .PHONY: components |
---|
56 | components: |
---|
57 | cd $(SRC_DIR)/lib && make; cd $(CUR_DIR) |
---|
58 | |
---|
59 | @for cmp in $(COMPONENTS); do\ |
---|
60 | cd $(SRC_DIR)/$$cmp && make && make copy; cd $(CUR_DIR); \ |
---|
61 | done |
---|
62 | |
---|
63 | |
---|
64 | # ------------------------------------------------------------------ |
---|
65 | # sekcja sprzatania (kasuje binaria z katalogow SRC/COMPONENTS) |
---|
66 | # ------------------------------------------------------------------ |
---|
67 | .PHONY: clean |
---|
68 | clean: clean_components clean_doc clean_dist |
---|
69 | @echo "All files cleaned successfully!" |
---|
70 | |
---|
71 | .PHONY: clean_components |
---|
72 | clean_components: |
---|
73 | @for cmp in $(COMPONENTS); do \ |
---|
74 | cd $(SRC_DIR)/$$cmp && make clean ; cd $(CUR_DIR); \ |
---|
75 | done |
---|
76 | cd $(SRC_DIR)/lib && make clean; cd $(CUR_DIR); |
---|
77 | |
---|
78 | .PHONY: clean_doc |
---|
79 | clean_doc: |
---|
80 | cd $(CUR_DIR)/doc && make clean; cd $(CUR_DIR) |
---|
81 | |
---|
82 | .PHONY: clean_dist |
---|
83 | clean_dist: |
---|
84 | |
---|
85 | |
---|
86 | # ------------------------------------------------------------------ |
---|
87 | # sekcja przygotowania paczki (programow wraz z dodatkowymi plikami) |
---|
88 | # ------------------------------------------------------------------ |
---|
89 | .PHONY: build |
---|
90 | build: compile build_conf build_share build_lib build_doc |
---|
91 | @echo "All files builded successfully!" |
---|
92 | |
---|
93 | .PHONY: build_conf |
---|
94 | build_conf: |
---|
95 | cp $(CUR_DIR)/conf/*.conf $(UTT_CONF_DIR)/ |
---|
96 | |
---|
97 | .PHONY: build_lib |
---|
98 | build_lib: |
---|
99 | cp $(CUR_DIR)/lib/* $(UTT_LIB_DIR)/ |
---|
100 | |
---|
101 | .PHONY: build_doc |
---|
102 | build_doc: |
---|
103 | cd $(CUR_DIR)/doc && make && make copy; cd $(CUR_DIR) |
---|
104 | |
---|
105 | .PHONY: build_share |
---|
106 | build_share: |
---|
107 | cp $(CUR_DIR)/share/* $(UTT_LANG_DIR)/ |
---|
108 | |
---|
109 | |
---|
110 | # ------------------------------------------------------------------ |
---|
111 | # sekcja tworzenia dystrybucji (tarballa, rpm, deb) |
---|
112 | # ------------------------------------------------------------------ |
---|
113 | .PHONY: distribute |
---|
114 | distribute: build dist_tarball dist_rpm |
---|
115 | @echo "All distributions created successfully!" |
---|
116 | |
---|
117 | .PHONY: dist_tarball |
---|
118 | dist_tarball: build |
---|
119 | cd $(CUR_DIR)/dist && make tarball; cd $(CUR_DIR) |
---|
120 | |
---|
121 | .PHONY: dist_rpm |
---|
122 | dist_rpm: build |
---|
123 | cd $(CUR_DIR)/dist && make rpm; cd $(CUR_DIR) |
---|
124 | |
---|
125 | .PHONY: dist_deb |
---|
126 | dist_deb: build |
---|
127 | cd $(CUR_DIR)/dist && make deb; cd $(CUR_DIR) |
---|
128 | |
---|
129 | |
---|
130 | # ------------------------------------------------------------------ |
---|
131 | # sekcja testowania (kasuje tarballa z TARBALL_TEST_DIR, |
---|
132 | # kompiluje, robi paczke, |
---|
133 | # tworzy tarballa i wgrywa go do TARBALL_TEST_DIR) |
---|
134 | # ------------------------------------------------------------------ |
---|
135 | #install: all |
---|
136 | # cd ${UTT_DIR} && make install; cd ${CUR_DIR} |
---|
137 | |
---|
138 | #uninstall: |
---|
139 | # cd ${UTT_DIR} && make uninstall; cd ${DIR} |
---|
140 | |
---|
141 | #reinstall: |
---|
142 | # cd ${UTT_DIR} && make reinstall; cd ${DIR} |
---|
143 | |
---|
144 | #dist: all |
---|
145 | # tar -czvf $(UTT_DIST_NAME).tgz $(UTT_DIR) |
---|
146 | |
---|
147 | |
---|
148 | #clean_dist: |
---|
149 | # if [ -d $(UTT_DIST_DIR) ]; then rm -r $(UTT_DIST_DIR); else true; fi |
---|
150 | # if [ -f $(UTT_DIST_FILE).tar.bz2 ]; then rm $(UTT_DIST_FILE).tar.bz2; else true; fi |
---|
151 | # if [ -f $(UTT_DIST_PMDB_FILE).tar.bz2 ]; then rm $(UTT_DIST_PMDB_FILE).tar.bz2; else true; fi |
---|