2016-06-28 18:18:55 +02:00
|
|
|
# var
|
2016-06-14 23:48:45 +02:00
|
|
|
CC = gcc
|
2016-06-28 18:18:55 +02:00
|
|
|
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
|
2016-06-14 23:48:45 +02:00
|
|
|
RM = /bin/rm
|
|
|
|
|
|
|
|
# src, .o, .out
|
|
|
|
SRC = ${wildcard *.c}
|
2016-06-28 18:18:55 +02:00
|
|
|
ASM = ${SRC:.c=.s}
|
2016-06-14 23:48:45 +02:00
|
|
|
OBJ = ${SRC:.c=.o}
|
|
|
|
ELF = ${SRC:.c=.out}
|
|
|
|
|
2016-06-28 18:18:55 +02:00
|
|
|
# targets
|
|
|
|
all: ${ELF}
|
|
|
|
:
|
|
|
|
asm: ${ASM}
|
|
|
|
:
|
|
|
|
|
|
|
|
# rules
|
2016-06-14 23:48:45 +02:00
|
|
|
${ELF}: ${OBJ}
|
|
|
|
${CC} ${OBJ} -o ${ELF}
|
|
|
|
|
2016-06-28 18:18:55 +02:00
|
|
|
|
2016-06-14 23:48:45 +02:00
|
|
|
# object
|
|
|
|
%.o: %.c
|
|
|
|
${CC} -c ${CFLAGS} $< -o $@
|
|
|
|
|
2016-06-28 18:18:55 +02:00
|
|
|
%.s: %.c
|
|
|
|
${CC} ${AFLAGS} $< -o $@
|
|
|
|
|
2016-06-14 23:48:45 +02:00
|
|
|
# cleanall
|
|
|
|
clean:
|
2016-06-28 18:18:55 +02:00
|
|
|
${RM} -f ${ELF} ${OBJ} ${ASM}
|