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">
<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.
</paragraph>
@ -79,17 +79,19 @@ project/
</code></pre>
</div>
<code-tag>makefile</code-tag>
<code-tag>Makefile</code-tag>
<div class="font-mono shadow-lg shadow-slate-500 p-2 mb-6">
<pre><code class="text-sm">
FC = gfortran # Fortran compiler
FFLAGS = -O2 # Compiler flags (optimization level)
# Makefile for hello.c
CC = gcc # C compiler
CFLAGS = -O2 # Compiler flags (optimization level)
hello: hello.o
$(FC) $(FFLAGS) -o $@ $^
$(CC) $(CFLAGS) -o $@ $^
hello.o: hello.f90
$(FC) $(FFLAGS) -c $<
hello.o: hello.c
$(CC) $(CFLAGS) -c $<
run:
./hello

View File

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