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 2107e0844173524c8d4cf5cc1ce07a21bbe2e517..69eb0a95ccde9d7698faaa99a7e196cdcb0971e0 100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-1,13
+1,19
@@
CC=cc
CFLAGS=-Wall -g
TARGET=roguelike
CC=cc
CFLAGS=-Wall -g
TARGET=roguelike
-OBJECTS=windows.o draw_wins.o keybindings.o readwrite.o roguelike.o
+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
roguelike: $(OBJECTS)
$(CC) $(CFLAGS) -o roguelike $(OBJECTS) -lncurses
-
%.o:
%.c
- $(CC) $(CFLAGS) -c $< -o $@
+
$(BUILDDIR)/%.o: $(SRCDIR)/
%.c
+
mkdir -p $(BUILDDIR);
$(CC) $(CFLAGS) -c $< -o $@
+.PHONY: clean
clean:
clean:
- rm $(OBJECTS); rm roguelike
+ rm $(OBJECTS)
+ rmdir $(BUILDDIR)
+ rm $(TARGET)