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}
|
2018-11-04 19:45:09 +01:00
|
|
|
:
|
2016-06-28 18:18:55 +02:00
|
|
|
asm: ${ASM}
|
2018-11-04 19:45:09 +01:00
|
|
|
:
|
2016-06-28 18:18:55 +02:00
|
|
|
|
|
|
|
# rules
|
2016-06-14 23:48:45 +02:00
|
|
|
${ELF}: ${OBJ}
|
2018-11-04 19:45:09 +01:00
|
|
|
${CC} ${OBJ} -o ${ELF}
|
2016-06-14 23:48:45 +02:00
|
|
|
|
2016-06-28 18:18:55 +02:00
|
|
|
|
2016-06-14 23:48:45 +02:00
|
|
|
# object
|
|
|
|
%.o: %.c
|
2018-11-04 19:45:09 +01:00
|
|
|
${CC} -c ${CFLAGS} $< -o $@
|
2016-06-14 23:48:45 +02:00
|
|
|
|
2016-06-28 18:18:55 +02:00
|
|
|
%.s: %.c
|
2018-11-04 19:45:09 +01:00
|
|
|
${CC} ${AFLAGS} $< -o $@
|
2016-06-28 18:18:55 +02:00
|
|
|
|
2016-06-14 23:48:45 +02:00
|
|
|
# cleanall
|
|
|
|
clean:
|
2018-11-04 19:45:09 +01:00
|
|
|
${RM} -f ${ELF} ${OBJ} ${ASM}
|
|
|
|
|