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