Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (28 sloc) 662 Bytes
SRC = $(shell find src/*.c)
OBJ = ${SRC:.c=.o}
CC = gcc
PREFIX = /usr/local
CFLAGS = -std=c99 -g -O0 -Wno-parentheses -Wno-switch-enum
CFLAGS += -I deps
# linenoise
CFLAGS += -I deps/linenoise
OBJ += deps/linenoise/linenoise.o
TEST_SRC = $(shell find {test,src}/*.c | sed '/luna/d')
TEST_OBJ = ${TEST_SRC:.c=.o}
CFLAGS += -I src
luna: $(OBJ)
$(CC) $^ $(LDFLAGS) -o $@
%.o: %.c
@$(CC) -c $(CFLAGS) $< -o $@
@echo CC $@
test: test_runner
@./$<
test_runner: $(TEST_OBJ)
$(CC) $^ -o $@
install: luna
install luna $(PREFIX)/bin
uninstall:
rm $(PREFIX)/bin/luna
clean:
rm -f luna test_runner $(OBJ) $(TEST_OBJ)
.PHONY: clean test install uninstall