htg-public/cpp/makefile

36 lines
535 B
Makefile

# var
CC = gcc
CFLAGS = -Wall -std=c11 -g -fno-stack-protector -z execstack
CANARY = -Wall -std=c11 -g -fstack-protector --param ssp-buffer-size=64
AFLAGS = -S -Wall -std=c11 -g
RM = /bin/rm
# src, .o, .out
SRC = ${wildcard *.c}
ASM = ${SRC:.c=.s}
OBJ = ${SRC:.c=.o}
ELF = ${SRC:.c=.out}
# targets
all: ${ELF}
:
asm: ${ASM}
:
# rules
${ELF}: ${OBJ}
${CC} ${OBJ} -o ${ELF}
# object
%.o: %.c
${CC} -c ${CFLAGS} $< -o $@
%.s: %.c
${CC} ${AFLAGS} $< -o $@
# cleanall
clean:
${RM} -f ${ELF} ${OBJ} ${ASM}