diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 60 |
1 files changed, 40 insertions, 20 deletions
@@ -1,30 +1,49 @@ -.PHONY: install uninstall dev clean test me a sandwich -name := halk -cc := gcc -flags := -devflags := -ggdb -fsanitize=leak,address,undefined -fno-omit-frame-pointer -sources := $(wildcard src/*.c) -sources := $(filter-out src/parser.c, $(sources)) # exclude the incomplete parser for now. -objects := $(sources:.c=.o) - -$(name): $(objects) - $(cc) $(objects) $(flags) -o ./$(name).out - -dev: $(objects) - $(cc) $(objects) $(devflags) -o ./$(name).out - -%.o: %.c include/%.h - $(cc) -c $(flags) $< -o $@ +PREFIX := /usr/local +BINDIR := $(PREFIX)/bin +BIN := halk +TMPBIN := halk.out +CC := gcc +FLAGS := +DEVFLAGS := -ggdb -fsanitize=leak,address,undefined -fno-omit-frame-pointer +SRCS := $(wildcard src/*.c) +SRCS := $(filter-out src/parser.c, $(SRCS)) # exclude the incomplete parser for now. +OBJS := $(SRCS:.c=.o) + +all: options HALK + +options: + @echo "HALK build options " + @echo "================== " + @echo "cc: $(CC) " + @echo "flags: $(FLAGS) " + @echo " " + +devoptions: + @echo "HALK build options (development) " + @echo "================================ " + @echo "cc: $(CC) " + @echo "flags: $(DEVFLAGS) " + @echo " " + +HALK: $(OBJS) + $(CC) $(OBJS) $(FLAGS) -o $(TMPBIN) + +dev: $(OBJS) + @make devoptions + $(CC) $(OBJS) $(DEVFLAGS) -o $(TMPBIN) install: make - cp ./$(name).out /usr/bin/$(name) + cp ./$(BIN).out $(BINDIR)/$(BIN) uninstall: - rm -f /usr/bin/$(name) + rm -f $(BINDIR)/$(BIN) clean: - rm -f ./$(name).out ./src/*.o + rm -f $(TMPBIN) src/*.o + +%.o: %.c include/%.h + $(CC) -c $(FLAGS) $< -o $@ # fun me: @@ -33,3 +52,4 @@ me: a sandwich: @exit +.PHONY: all options devoptions dev install uninstall clean |