diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 37 |
1 files changed, 19 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." |