This commit is contained in:
Rasmus Rasmussen 2025-03-10 15:36:46 +01:00
parent 633e5a4c64
commit 32b85f26b7
2 changed files with 12 additions and 10 deletions

View File

@ -29,7 +29,7 @@ import CodeTag from "../tags/CodeTag.vue";
<hr class="mb-6"> <hr class="mb-6">
<paragraph>For any big C projects, a project structure is very important. It helps to organize and keep track of our <paragraph>For any big C projects, a project structure is very important. It helps to organize and keep track of our
classes and libraries. But for smaller projects, or just for testing purposes, a project structure could be too code. But for smaller projects, or just for testing purposes, a project structure could be too
redundant. redundant.
</paragraph> </paragraph>
@ -79,23 +79,25 @@ project/
</code></pre> </code></pre>
</div> </div>
<code-tag>makefile</code-tag> <code-tag>Makefile</code-tag>
<div class="font-mono shadow-lg shadow-slate-500 p-2 mb-6"> <div class="font-mono shadow-lg shadow-slate-500 p-2 mb-6">
<pre><code class="text-sm"> <pre><code class="text-sm">
FC = gfortran # Fortran compiler # Makefile for hello.c
FFLAGS = -O2 # Compiler flags (optimization level)
CC = gcc # C compiler
CFLAGS = -O2 # Compiler flags (optimization level)
hello: hello.o hello: hello.o
$(FC) $(FFLAGS) -o $@ $^ $(CC) $(CFLAGS) -o $@ $^
hello.o: hello.f90 hello.o: hello.c
$(FC) $(FFLAGS) -c $< $(CC) $(CFLAGS) -c $<
run: run:
./hello ./hello
clean: clean:
rm -f *.o hello rm -f *.o hello
</code></pre> </code></pre>
</div> </div>

View File

@ -103,7 +103,7 @@ end program hello
</code></pre> </code></pre>
</div> </div>
<code-tag>makefile</code-tag> <code-tag>Makefile</code-tag>
<div class="font-mono shadow-lg shadow-slate-500 p-2 mb-6"> <div class="font-mono shadow-lg shadow-slate-500 p-2 mb-6">
<pre><code class="text-sm"> <pre><code class="text-sm">
FC = gfortran # Fortran compiler FC = gfortran # Fortran compiler