1MKDIR = mkdir -p
2
3DEST_HOME=/usr/local
4DEST_BIN=$(DEST_HOME)/bin
5DEST_SHARE=$(DEST_HOME)/lib/p7zip
6DEST_SHARE_DOC=$(DEST_HOME)/share/doc/p7zip
7DEST_MAN=$(DEST_HOME)/man
8
9.PHONY: default all all2 7za 7zG sfx 7z 7zr Client7z common common7z clean tar_bin depend test test_7z test_7zr test_7zG test_Client7z all_test
10
11default:7za
12
13all:7za sfx
14
15all2: 7za sfx 7z
16
17all3: 7za sfx 7z 7zr
18
19all_test : test test_7z test_7zr test_Client7z
20	$(MAKE) -C CPP/7zip/Compress/PPMD_Alone  test
21	$(MAKE) -C CPP/7zip/Compress/LZMA_Alone  test
22
23common:
24	$(MKDIR) bin
25
267za: common
27	$(MAKE) -C CPP/7zip/Bundles/Alone all
28
297zr: common
30	$(MAKE) -C CPP/7zip/Bundles/Alone7z  all
31
32Client7z: common
33	$(MKDIR) bin/Codecs
34	$(MAKE) -C CPP/7zip/Bundles/Format7zFree all
35	$(MAKE) -C CPP/7zip/UI/Client7z          all
36
37depend:
38	$(MAKE) -C CPP/7zip/Bundles/Alone         depend
39	$(MAKE) -C CPP/7zip/Bundles/Alone7z       depend
40	$(MAKE) -C CPP/7zip/Bundles/SFXCon        depend
41	$(MAKE) -C CPP/7zip/UI/Client7z           depend
42	$(MAKE) -C CPP/7zip/UI/Console            depend
43	$(MAKE) -C CPP/7zip/Bundles/Format7zFree  depend
44	$(MAKE) -C CPP/7zip/Compress/Rar          depend
45	$(MAKE) -C CPP/7zip/UI/GUI                depend
46
47sfx: common
48	$(MKDIR) bin
49	$(MAKE) -C CPP/7zip/Bundles/SFXCon  all
50
51common7z:common
52	$(MKDIR) bin/Codecs
53	$(MAKE) -C CPP/7zip/Bundles/Format7zFree all
54	$(MAKE) -C CPP/7zip/Compress/Rar         all
55
567z: common7z
57	$(MAKE) -C CPP/7zip/UI/Console           all
58
597zG: common7z
60	cd bin ; rm -f Lang ; ln -s ../GUI/Lang .
61	cd bin ; rm -f help ; ln -s ../GUI/help .
62	$(MAKE) -C CPP/7zip/UI/GUI               all
63
64clean:
65	$(MAKE) -C CPP/myWindows                 clean
66	$(MAKE) -C CPP/7zip/Bundles/Alone        clean
67	$(MAKE) -C CPP/7zip/Bundles/Alone7z      clean
68	$(MAKE) -C CPP/7zip/Bundles/SFXCon       clean
69	$(MAKE) -C CPP/7zip/UI/Client7z          clean
70	$(MAKE) -C CPP/7zip/UI/Console           clean
71	$(MAKE) -C CPP/7zip/UI/FileManager       clean
72	$(MAKE) -C CPP/7zip/UI/GUI               clean
73	$(MAKE) -C CPP/7zip/Bundles/Format7zFree clean
74	$(MAKE) -C CPP/7zip/Compress/Rar         clean
75	$(MAKE) -C CPP/7zip/Compress/LZMA_Alone  clean
76	$(MAKE) -C CPP/7zip/Compress/PPMD_Alone  clean
77	$(MAKE) -C CPP/7zip/Bundles/AloneGCOV    clean
78	rm -fr bin
79	rm -fr CPP/7zip/CMAKE/Alone
80	rm -f make.log 1 2
81	rm -f check/7z.so
82	find . -name "*~" -exec rm -f {} \;
83	find . -name "*.orig" -exec rm -fr {} \;
84	find . -name ".*.swp" -exec rm -f {} \;
85	find . -name "*.[ch]" -exec chmod -x {} \;
86	find . -name "*.cpp" -exec chmod -x {} \;
87	find . -name "*.asm" -exec chmod -x {} \;
88	find . -name "makefile*" -exec chmod -x {} \;
89	chmod -x ChangeLog README TODO man1/* DOCS/*.txt
90	chmod +x contrib/VirtualFileSystemForMidnightCommander/u7z
91	chmod +x contrib/gzip-like_CLI_wrapper_for_7z/p7zip
92	chmod +x install.sh check/check.sh check/clean_all.sh check/check_7zr.sh
93	cd check                  ; ./clean_all.sh
94
95test: 7za sfx
96	cd check ; ./check.sh ../bin/7za
97
98test_7z: 7z sfx
99	cd check ; ./check.sh ../bin/7z
100
101test_7zr: 7zr sfx
102	cd check ; ./check_7zr.sh ../bin/7zr
103
104test_7zG: 7zG sfx
105	cd check ; ./check.sh ../bin/7zG
106
107test_Client7z: Client7z
108	cd check ; ./check_Client7z.sh ../bin/Client7z
109
110install:
111	./install.sh $(DEST_BIN) $(DEST_SHARE) $(DEST_MAN) $(DEST_SHARE_DOC) $(DEST_DIR)
112
113REP=$(shell pwd)
114ARCHIVE=$(shell basename $(REP))
115
116.PHONY: tar_all tar_all2 src_7z tar_bin tar_bin2
117
118tar_all : clean
119	rm -f  ../$(ARCHIVE)_src_all.tar.bz2
120	cp makefile.linux_x86_ppc_alpha makefile.machine
121	cd .. ; (tar cf - $(ARCHIVE) | bzip2 -9 > $(ARCHIVE)_src_all.tar.bz2)
122
123tar_all2 : clean
124	rm -f  ../$(ARCHIVE)_src_all.tar.bz2
125	cp makefile.linux_x86_ppc_alpha makefile.machine
126	cd .. ; (tar cf - $(ARCHIVE) | 7za a -mx=9 -tbzip2 -si $(ARCHIVE)_src_all.tar.bz2 )
127
128src_7z : clean
129	rm -f  ../$(ARCHIVE)_src.7z
130	cd .. ; 7za a -mx=9 -m0=ppmd:mem=128m:o=32 $(ARCHIVE)_src.7z $(ARCHIVE)
131
132tar_bin:
133	rm -f  ../$(ARCHIVE)_x86_linux_bin.tar.bz2
134	chmod +x install.sh contrib/VirtualFileSystemForMidnightCommander/u7z contrib/gzip-like_CLI_wrapper_for_7z/p7zip
135	cd .. ; (tar cf - $(ARCHIVE)/bin $(ARCHIVE)/contrib $(ARCHIVE)/man1 $(ARCHIVE)/install.sh $(ARCHIVE)/ChangeLog $(ARCHIVE)/DOCS $(ARCHIVE)/README $(ARCHIVE)/TODO | bzip2 -9 > $(ARCHIVE)_x86_linux_bin.tar.bz2)
136
137tar_bin2:
138	rm -f  ../$(ARCHIVE)_x86_linux_bin.tar.bz2
139	chmod +x install.sh contrib/VirtualFileSystemForMidnightCommander/u7z contrib/gzip-like_CLI_wrapper_for_7z/p7zip
140	cd .. ; (tar cf - $(ARCHIVE)/bin $(ARCHIVE)/contrib $(ARCHIVE)/man1 $(ARCHIVE)/install.sh $(ARCHIVE)/ChangeLog $(ARCHIVE)/DOCS $(ARCHIVE)/README $(ARCHIVE)/TODO | 7za a -mx=9 -tbzip2 -si $(ARCHIVE)_x86_linux_bin.tar.bz2)
141
142