-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
43 lines (36 loc) · 1.01 KB
/
Copy pathmakefile
File metadata and controls
43 lines (36 loc) · 1.01 KB
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
# makefile for the GNU Compiler Collection
# compilers
your_CC = gcc
your_FC = gfortran
# compiler flags
output_flags = -o $@
ccflags = -std=c17
fcflags = -std=f2018 -fimplicit-none
fwarning_flags = -Wall -Wsurprising -W -pedantic -Warray-temporaries \
-Wcharacter-truncation -Wconversion-extra -Wimplicit-interface \
-Wimplicit-procedure -Winteger-division -Wintrinsics-std \
-Wreal-q-constant -Wuse-without-only -Wrealloc-lhs-all
cwarning_flags = -Wall -W -pedantic
all: c f
c: hello.c makefile
@echo compiling C++...
$(your_CC) $(ccflags) $(cwarning_flags) $< $(output_flags)
f: hello.f makefile
@echo compiling fortan...
$(your_FC) $(fcflags) $(fwarning_flags) $< $(output_flags) -fall-intrinsics
clean:
@echo removing files...
@rm -fv *.o | sed 's/^/ /'
@rm -fv *.exe | sed 's/^/ /'
@rm -fv a.out | sed 's/^/ /'
run: c f
@echo
./c
@echo
./f
@echo
python hello.py
@echo
bash hello.sh
@echo
@if command -v matlab 1> /dev/null; then matlab -nodesktop -batch "hello_world"; else echo "matlab not found"; fi