Skip to content

Instantly share code, notes, and snippets.

@harryhanYuhao
Last active November 19, 2023 21:20
Show Gist options
  • Save harryhanYuhao/00bb3c7531f0a54ffd35b4ac548ffb38 to your computer and use it in GitHub Desktop.
Save harryhanYuhao/00bb3c7531f0a54ffd35b4ac548ffb38 to your computer and use it in GitHub Desktop.
gcc makefile
CC=gcc
CWARNINGS=-Wall -Wextra -Wpedantic -Wformat=2 -Wswitch-default -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 -Waggregate-return -Wformat=2 -Wfatal-errors
COPTIMISING=-O0 -ggdb3 -fno-omit-frame-pointer -ffloat-store -fno-common -fstrict-aliasing -g
CFLAGS=-std=c11 $(CWARNINGS) $(COPTIMISING) -lm
INSTALL_DIR=$(HOME)/psu/bin
# Auxillary Variables
RED=\033[0;31m
BLUE=\033[0;34m
NC=\033[0m
a.out: main.c
@echo "--------------------------------------------------"
@echo -e "$(RED)LINKING$(NC): Producing Executable "
@$(CC) $(CFLAGS) main.c -o a.out
@echo "--------------------------------------------------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment