Created
July 30, 2021 02:03
-
-
Save ggorlen/5642fc52bbbde5edc960142682af2b80 to your computer and use it in GitHub Desktop.
Compile C script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| if [ "$#" -ne 2 ]; then | |
| echo "Usage: ./compile_c.sh in.c out.out" | |
| exit 1 | |
| elif [ $1 -eq $2 ]; then | |
| echo "error: overwriting source file '$1'" | |
| exit 1 | |
| fi | |
| gcc -std=c99 -pedantic -Wall \ | |
| -Wno-missing-braces -Wextra -Wno-missing-field-initializers -Wformat=2 \ | |
| -Wswitch-default -Wswitch-enum -Wcast-align -Wpointer-arith \ | |
| -Wbad-function-cast -Wstrict-overflow=5 -Wstrict-prototypes -Winline \ | |
| -Wundef -Wnested-externs -Wcast-qual -Wshadow -Wunreachable-code \ | |
| -Wlogical-op -Wfloat-equal -Wstrict-aliasing=2 -Wredundant-decls \ | |
| -Wold-style-definition -Werror \ | |
| -ggdb3 \ | |
| -O0 \ | |
| -fno-omit-frame-pointer -ffloat-store -fno-common -fstrict-aliasing \ | |
| -lm \ | |
| -o $2 \ | |
| $1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment