forked from MosheWagner/Orayta-Books
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenMakeFile.sh
executable file
·41 lines (30 loc) · 1.18 KB
/
GenMakeFile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /bin/bash
echo "Generating makefile"
echo "* Generating Makefile..."
#Generate makefile
mkfile="#AutoBuilt MakeFile. <[email protected]>\n"
mkfile=$mkfile"COPY = cp -fr\n"
mkfile=$mkfile"COPY_FILE = \$(COPY)\n"
mkfile=$mkfile"COPY_DIR = \$(COPY) -r\n"
Cmkfile=$mkfile"HK_DIR_EXISTS= test -d\n"
mkfile=$mkfile"MKDIR = mkdir -p\n"
mkfile=$mkfile"RM = rm -fr \n\n"
mkfile=$mkfile"clean:"
mkfile=$mkfile"\n\n"
mkfile=$mkfile"distclean:"
mkfile=$mkfile"\n\n"
mkfile=$mkfile"install: install_books"
mkfile=$mkfile"\n\n"
mkfile=$mkfile"uninstall: uninstall_books \n"
il="install_books:\n"
il=$il"\t@\$(CHK_DIR_EXISTS) \$(DESTDIR)/usr/share/Orayta || \$(MKDIR) \$(DESTDIR)/usr/share/Orayta/\n"
il=$il"\t@\$(CHK_DIR_EXISTS) \$(DESTDIR)/usr/share/Orayta/Books/ || \$(MKDIR) \$(DESTDIR)/usr/share/Orayta/Books/\n"
rml="uninstall_books:\n"
l=$l`find books/ -name '*_*' -prune | sed 's/\(.*\)/\x27\1\x27/g'`
for j in $l;
do il=$il"\t\$(COPY) "$j" \$(DESTDIR)/usr/share/Orayta/Books/\n";
rml=$rml"\t\$(RM) \$(DESTDIR)/usr/share/Orayta/Books/"$j"\n";
done
il=$il"\tchmod 777 \$(DESTDIR)/usr/share/Orayta/Books\n"
mkfile=$mkfile"\n\n"$il"\n"$rml
echo -e $mkfile > Makefile