csope/Makefile

39 lines
682 B
Makefile
Raw Normal View History

2023-07-27 14:04:50 -04:00
CC=gcc
2023-07-29 09:40:48 -04:00
CFLAGS:=-ggdb
2023-08-01 13:36:53 -04:00
LDLIBS=-I ${CHDRD} $$(pkg-config --libs ncurses readline)
2023-07-27 14:04:50 -04:00
LEX:=flex
LEXD:=src/
LEXF:=$(shell find ${LEXD} -iname '*.l')
GENLEX:=$(subst .l,.c,${LEXF})
SRCD:=src/
OBJD:=obj/
SRC:=$(shell find ${SRCD} -iname '*.c') ${GENLEX}
OBJ:=$(subst .c,.o,$(subst ${SRCD},${OBJD},${SRC}))
HDRD:=${SRCD}
CHDRD:=${OBJD}
HDR:=$(shell find ${HDRD} -iname '*.h')
CHDR:=$(addsuffix .gch,$(subst ${HDRD},${CHDRD},${HDR}))
OUTPUT:=csope
main: ${CHDR} ${OBJ}
${LINK.c} ${LDLIBS} ${OBJ} -o ${OUTPUT}
obj/%.o: src/%.c
${COMPILE.c} $< -o $@
src/%.c: src/%.l
${LEX} -o $@ $<
obj/%.h.gch: src/%.h
${CC} $< -o $@
clean:
-rm ${CHDR}
-rm ${GENLEX}
-rm ${OBJ}
-rm ${OUTPUT}