-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakemake.sh
More file actions
executable file
·53 lines (42 loc) · 978 Bytes
/
Copy pathmakemake.sh
File metadata and controls
executable file
·53 lines (42 loc) · 978 Bytes
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
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Executable name required."
echo "usage: makemake.sh executable_name"
exit
fi
obejects=""
echo -n "$1 :" > Makefile
name=$1
shift
constant="g++ -ansi -Wall -g -c"
argu=""
head=""
for i in $@ ; do
argu="$argu $i"
done
for i in $(ls *.cpp) ; do
objects="$objects ${i%%.*}"
done
for i in $objects ; do
echo -n " $i.o" >> Makefile
done
echo >> Makefile
echo -n -e "\tg++ -ansi -Wall -g -o $name $argu " >> Makefile
for i in $objects ; do
echo -n "$i.o " >> Makefile
done
echo >> Makefile
echo >> Makefile
for i in $objects ; do
echo -n "$i.o :" >> Makefile
echo -n " $i.cpp " >> Makefile
echo -n $(grep "^#include \".*\.h\"" "$i.cpp" | awk '{print $2}' | sed 's/"/ /g') >> Makefile
echo >> Makefile
echo -e "\t$constant $argu $i.cpp" >> Makefile
echo >> Makefile
done
echo "clean :" >> Makefile
echo -n -e "\trm -f $name" >> Makefile
for i in $objects ; do
echo -n " $i.o" >> Makefile
done