aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-20 22:57:28 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-20 22:58:22 -0400
commitd6f244f7d9f52462bafb608f23494707eeb24751 (patch)
tree8b2cab0559f4fce36b20896b24b38b54b6267400 /Makefile
parent29f45358ccc638f7c2ce951e03d91bbd02d6a109 (diff)
downloadrunes-d6f244f7d9f52462bafb608f23494707eeb24751.tar.gz
runes-d6f244f7d9f52462bafb608f23494707eeb24751.zip
clean up the directory structure a bit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 17 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 141e7dd..866ed58 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,13 @@
OUT = runes
-OBJ = runes.o display.o term.o parser.o config.o window-xlib.o pty-unix.o
+BUILD = build/
+SRC = src/
+OBJ = $(BUILD)runes.o \
+ $(BUILD)display.o \
+ $(BUILD)term.o \
+ $(BUILD)parser.o \
+ $(BUILD)config.o \
+ $(BUILD)window-xlib.o \
+ $(BUILD)pty-unix.o
LIBS = cairo cairo-xlib libuv pangocairo
CFLAGS ?= -g -Wall -Wextra -Werror
LDFLAGS ?= -g -Wall -Wextra -Werror
@@ -7,23 +15,25 @@ LDFLAGS ?= -g -Wall -Wextra -Werror
ALLCFLAGS = $(shell pkg-config --cflags $(LIBS)) $(CFLAGS)
ALLLDFLAGS = $(shell pkg-config --libs $(LIBS)) $(LDFLAGS)
-MAKEDEPEND = $(CC) $(ALLCFLAGS) -M -MP -MT '$@ $(@:%.o=.%.d)'
+MAKEDEPEND = $(CC) $(ALLCFLAGS) -M -MP -MT '$@ $(@:$(BUILD)%.o=$(BUILD).%.d)'
build: $(OUT)
$(OUT): $(OBJ)
$(CC) $(ALLLDFLAGS) -o $@ $^
-%.o: %.c
- @$(MAKEDEPEND) -o $(<:%.c=.%.d) $<
+$(BUILD)%.o: $(SRC)%.c
+ @mkdir -p $(BUILD)
+ @$(MAKEDEPEND) -o $(<:$(SRC)%.c=$(BUILD).%.d) $<
$(CC) $(ALLCFLAGS) -c -o $@ $<
-%.c: %.l
+$(SRC)%.c: $(SRC)%.l
$(LEX) -o $@ $<
clean:
- rm -f $(OUT) $(OBJ) $(OBJ:%.o=.%.d)
+ rm -f $(OUT) $(OBJ) $(OBJ:$(BUILD)%.o=$(BUILD).%.d)
+ @rmdir -p $(BUILD) > /dev/null 2>&1
--include $(OBJ:%.o=.%.d)
+-include $(OBJ:$(BUILD)%.o=$(BUILD).%.d)
.PHONY: build clean