forked from uva-cs/pdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.html
54 lines (44 loc) · 2.89 KB
/
Makefile.html
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
54
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="GNU source-highlight
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite">
<title>Makefile</title>
</head>
<body style="background-color:white">
<pre><i><span style="color:#9A1900"># Makefile for CS 2150 pre-lab 8</span></i>
<i><span style="color:#9A1900"># This Makefile shows how to link assembly with C/C++</span></i>
<i><span style="color:#9A1900"># Defines the C++ compiler we'll be using</span></i>
<span style="color:#009900">CXX =</span> clang<span style="color:#990000">++</span> -m<span style="color:#993399">64</span>
<i><span style="color:#9A1900"># Defines the flags we'll be passing to the C++ compiler</span></i>
<span style="color:#009900">CXXFLAGS =</span> -Wall -g
<i><span style="color:#9A1900"># Defines the assembler</span></i>
<span style="color:#009900">AS =</span> nasm
<i><span style="color:#9A1900"># Defines the flags for the assembler</span></i>
<span style="color:#009900">ASFLAGS =</span> -f elf64 -g
<i><span style="color:#9A1900"># All of the .o files for our program</span></i>
<span style="color:#009900">OFILES =</span> vecsum.o main.o
<i><span style="color:#9A1900"># This tells make to create a .o file from a .cpp file, using the</span></i>
<i><span style="color:#9A1900"># defaults above (i.e. the CXX and CXXFLAGS macros)</span></i>
<b><span style="color:#000080">.SUFFIXES:</span></b> .o .cpp
<i><span style="color:#9A1900"># This tells make to create a .o file from a .s file, using the</span></i>
<i><span style="color:#9A1900"># defaults above (i.e. the AS and ASFLAGS macros)</span></i>
<b><span style="color:#000080">.SUFFIXES:</span></b> .o .s
<i><span style="color:#9A1900"># How to compile our final program. Note that we do NOT specify an</span></i>
<i><span style="color:#9A1900"># output executable name -- in order for this to work with the grading</span></i>
<i><span style="color:#9A1900"># system, the file needs to be a.out (a.exe in Cygwin).</span></i>
<span style="color:#990000">main:</span> <span style="color:#009900">$(OFILES)</span>
<span style="color:#009900">$(CXX)</span> <span style="color:#009900">$(CXXFLAGS)</span> <span style="color:#009900">$(OFILES)</span>
<i><span style="color:#9A1900"># This will clean up (remove) all our object files. The -f option</span></i>
<i><span style="color:#9A1900"># tells rm to forcily remove the files (i.e. don't ask if they should</span></i>
<i><span style="color:#9A1900"># be removed or not). This removes object files (*.o) and Emacs</span></i>
<i><span style="color:#9A1900"># backup files (*~)</span></i>
<span style="color:#990000">clean:</span>
/bin/rm -f <span style="color:#990000">*</span>.o <span style="color:#990000">*~</span>
<i><span style="color:#9A1900"># We don't have any dependencies for this small program</span></i>
</pre>
</body>
</html>