37 lines
823 B
Makefile
37 lines
823 B
Makefile
|
# Make script for Chad projects
|
||
|
# This script depends on the following variables
|
||
|
# - TARGET : output program name
|
||
|
# - ARGS : default flags to fork ${OUT} with
|
||
|
|
||
|
PREFIX:=/usr/bin
|
||
|
|
||
|
CFLAGS:=-std=c99
|
||
|
CPPFLAGS:=-D_GNU_SOURCE -D_FORTIFY_SOURCE=2
|
||
|
|
||
|
DEBUG=1
|
||
|
|
||
|
ifeq (${DEBUG},1)
|
||
|
CFLAGS += -Og -ggdb -pg -fno-inline
|
||
|
else
|
||
|
CFLAGS += -O2 -flto=auto
|
||
|
endif
|
||
|
|
||
|
# Programs to check warnings for as defined by the chad standard
|
||
|
|
||
|
GCC:=gcc
|
||
|
GCC.warnings:=-Wall -Wextra -Wpedantic -Wvla -Wshadow -Wundef
|
||
|
|
||
|
CLANG:=clang
|
||
|
CLANG.warnings:=-Weverything
|
||
|
|
||
|
VALGRIND:=valgrind
|
||
|
VALGRIND.flags:=--track-origins=yes --leak-check=full --show-leak-kinds=all
|
||
|
|
||
|
TARGET:=hl
|
||
|
ARGS:=${TARGET} < source/main.c
|
||
|
|
||
|
chad_test:
|
||
|
${GCC} ${GCC.warnings} ${SRC} -o ${TARGET}
|
||
|
${CLANG} ${GCC.warnings} ${SRC} -o ${TARGET}
|
||
|
${VALGRIND} ${VALGRIND.flags} ${TARGET} ${ARGS}
|