home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Restructured source tree. Code moves to src/, object files to build/.
[plomrogue]
/
Makefile
diff --git
a/Makefile
b/Makefile
index 7a60ae07bc66d3517a0028a96311d038598cd0ae..69eb0a95ccde9d7698faaa99a7e196cdcb0971e0 100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-1,7
+1,19
@@
-roguelike:
- cc -g -o windows.o -c windows.c
- cc -g -o roguelike.o -c roguelike.c
- cc -g -o roguelike windows.o roguelike.o -lncurses
+CC=cc
+CFLAGS=-Wall -g
+TARGET=roguelike
+SRCDIR=src
+BUILDDIR=build
+SOURCES=$(shell find $(SRCDIR)/ -type f -name \*.c)
+OBJECTS=$(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.c=.o))
+roguelike: $(OBJECTS)
+ $(CC) $(CFLAGS) -o roguelike $(OBJECTS) -lncurses
+
+$(BUILDDIR)/%.o: $(SRCDIR)/%.c
+ mkdir -p $(BUILDDIR); $(CC) $(CFLAGS) -c $< -o $@
+
+.PHONY: clean
clean:
clean:
- rm *.o; rm roguelike
+ rm $(OBJECTS)
+ rmdir $(BUILDDIR)
+ rm $(TARGET)