diff options
-rw-r--r-- | Makefile | 37 | ||||
-rw-r--r-- | src/include/doer.h | 6 |
2 files changed, 25 insertions, 18 deletions
@@ -3,10 +3,11 @@ PREFIX := /usr/local/bin CC := gcc REG_CFLAGS := -ansi -O3 -s DBG_CFLAGS := -ansi -Og -ggdb -pedantic -DBG_CFLAGS += -Wall -Wno-deprecated-declarations +DBG_CFLAGS += -Wall -Wextra -Wformat DBG_CFLAGS += -fsanitize=leak,address,undefined -fno-omit-frame-pointer -CFLAGS := ${REG_CFLAGS} +CFLAGS := $(REG_CFLAGS) SRCS := $(wildcard src/*.c) +SRCS := $(filter-out %doer.c,$(SRCS)) # Filter out incomplete doer for now. OBJS := $(SRCS:.c=.o) .PHONY: all reg_options dbg_options halk dbg install uninstall clean me a sandwich @@ -15,38 +16,38 @@ all: halk reg_options: @echo "HALK build options:" - @echo "CC: ${CC}" - @echo "CFLAGS: ${REG_CFLAGS}" + @echo "CC: $(CC)" + @echo "CFLAGS: $(REG_CFLAGS)" @echo dbg_options: @echo "HALK build options (dbg):" - @echo "CC: ${CC}" - @echo "CFLAGS: ${DBG_CFLAGS}" + @echo "CC: $(CC)" + @echo "CFLAGS: $(DBG_CFLAGS)" @echo -halk: reg_options ${OBJS} - ${CC} ${OBJS} ${REG_CFLAGS} -o ${BIN}.out +halk: reg_options $(OBJS) + $(CC) $(OBJS) $(REG_CFLAGS) -o $(BIN).out -dbg: CFLAGS := ${DBG_CFLAGS} -dbg: dbg_options ${OBJS} - ${CC} ${OBJS} ${DBG_CFLAGS} -o ${BIN}.out +dbg: CFLAGS := $(DBG_CFLAGS) +dbg: dbg_options $(OBJS) + $(CC) $(OBJS) $(DBG_CFLAGS) -o $(BIN).out %.o: %.c - ${CC} -c $< -o $@ + $(CC) -c $< -o $@ install: all - mkdir -p ${PREFIX} - cp -f ${BIN}.out ${PREFIX}/${BIN} - chmod 755 ${PREFIX}/${BIN} + mkdir -p $(PREFIX) + cp -f $(BIN).out $(PREFIX)/$(BIN) + chmod 755 $(PREFIX)/$(BIN) uninstall: - rm -f ${PREFIX}/${BIN} + rm -f $(PREFIX)/$(BIN) clean: - rm -f ${BIN}.out src/*.o + rm -f $(BIN).out src/*.o me a: @exit sandwich: - @[ "${USER}" = "root" ] && echo "Okay." || echo "What? Make it yourself." + @[ "$(USER)" = "root" ] && echo "Okay." || echo "What? Make it yourself." diff --git a/src/include/doer.h b/src/include/doer.h index f349749..f527114 100644 --- a/src/include/doer.h +++ b/src/include/doer.h @@ -9,7 +9,13 @@ typedef struct DOER { tree_t* tree; } doer_t; +/* Creates a new parser. */ doer_t* doer_init(tree_t* tree); + +/* + Destroys a doer. + - Does not free the `tree`. +*/ void doer_destroy(doer_t* doer); void doer_do_blin_print(char* s); |