home · contact · privacy
Restructured source tree. Code moves to src/, object files to build/.
[plomrogue] / Makefile
1 CC=cc
2 CFLAGS=-Wall -g
3 TARGET=roguelike
4 SRCDIR=src
5 BUILDDIR=build
6 SOURCES=$(shell find $(SRCDIR)/ -type f -name \*.c)
7 OBJECTS=$(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.c=.o))
8
9 roguelike: $(OBJECTS)
10         $(CC) $(CFLAGS) -o roguelike $(OBJECTS) -lncurses
11
12 $(BUILDDIR)/%.o: $(SRCDIR)/%.c
13         mkdir -p $(BUILDDIR); $(CC) $(CFLAGS) -c $< -o $@
14
15 .PHONY: clean
16 clean:
17         rm $(OBJECTS)
18         rmdir $(BUILDDIR)
19         rm $(TARGET)