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	cd CPP/7zip/Compress/PPMD_Alone  ; $(MAKE) test
21	cd CPP/7zip/Compress/LZMA_Alone  ; $(MAKE) test
22
23common:
24	$(MKDIR) bin
25
267za: common
27	cd CPP/7zip/Bundles/Alone ; $(MAKE) all
28
297zr: common
30	cd CPP/7zip/Bundles/Alone7z ; $(MAKE) all
31
32Client7z: common
33	$(MKDIR) bin/Codecs
34	cd CPP/7zip/Bundles/Format7zFree ; $(MAKE) all
35	cd CPP/7zip/UI/Client7z      ; $(MAKE) all
36
37depend:
38	cd CPP/7zip/Bundles/Alone     ; $(MAKE) depend
39	cd CPP/7zip/Bundles/Alone7z   ; $(MAKE) depend
40	cd CPP/7zip/Bundles/SFXCon    ; $(MAKE) depend
41	cd CPP/7zip/UI/Client7z       ; $(MAKE) depend
42	cd CPP/7zip/UI/Console        ; $(MAKE) depend
43	cd CPP/7zip/Bundles/Format7zFree ; $(MAKE) depend
44	cd CPP/7zip/Compress/Rar      ; $(MAKE) depend
45	cd CPP/7zip/UI/GUI            ; $(MAKE) depend
46
47sfx: common
48	$(MKDIR) bin
49	cd CPP/7zip/Bundles/SFXCon ; $(MAKE) all
50
51common7z:common
52	$(MKDIR) bin/Codecs
53	cd CPP/7zip/Bundles/Format7zFree ; $(MAKE) all
54	cd CPP/7zip/Compress/Rar         ; $(MAKE) all
55
567z: common7z
57	cd CPP/7zip/UI/Console           ; $(MAKE) 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	cd CPP/7zip/UI/GUI               ; $(MAKE) all
63
64clean:
65	cd CPP/myWindows                 ; $(MAKE) clean
66	cd CPP/7zip/Bundles/Alone        ; $(MAKE) clean
67	cd CPP/7zip/Bundles/Alone7z      ; $(MAKE) clean
68	cd CPP/7zip/Bundles/SFXCon       ; $(MAKE) clean
69	cd CPP/7zip/UI/Client7z          ; $(MAKE) clean
70	cd CPP/7zip/UI/Console           ; $(MAKE) clean
71	cd CPP/7zip/UI/FileManager       ; $(MAKE) clean
72	cd CPP/7zip/UI/GUI               ; $(MAKE) clean
73	cd CPP/7zip/Bundles/Format7zFree ; $(MAKE) clean
74	cd CPP/7zip/Compress/Rar         ; $(MAKE) clean
75	cd CPP/7zip/Compress/LZMA_Alone  ; $(MAKE) clean
76	cd CPP/7zip/Compress/PPMD_Alone  ; $(MAKE) clean
77	cd CPP/7zip/Bundles/AloneGCOV    ; $(MAKE) 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