home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Some refactoring in map_object_actions library.
[plomrogue]
/
Makefile
diff --git
a/Makefile
b/Makefile
index 69eb0a95ccde9d7698faaa99a7e196cdcb0971e0..56a158c56c346e524046b30dbd3c89ca4ed2ded4 100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-1,17
+1,24
@@
-CC=cc
-CFLAGS=-Wall -g
TARGET=roguelike
SRCDIR=src
BUILDDIR=build
TARGET=roguelike
SRCDIR=src
BUILDDIR=build
+CC=gcc
+CFLAGS=-Wall -g
+
+# Use all .c files below SRCDIR for sources. Build object file paths by
+# replacing SRCDIR with BUILDDIR and .c endings with .o endings.
SOURCES=$(shell find $(SRCDIR)/ -type f -name \*.c)
OBJECTS=$(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.c=.o))
SOURCES=$(shell find $(SRCDIR)/ -type f -name \*.c)
OBJECTS=$(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.c=.o))
-roguelike: $(OBJECTS)
+# Linking TARGET demands generation of all OBJECTS files. To build them,
+# rely on this rule: Each file of path BUILDDIR/[name].o is compiled
+# from a file of path SRCDIR/[name].c. Build BUILDDIR as needed.
+$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) -o roguelike $(OBJECTS) -lncurses
$(CC) $(CFLAGS) -o roguelike $(OBJECTS) -lncurses
-
$(BUILDDIR)/%.o: $(SRCDIR)/%.c
mkdir -p $(BUILDDIR); $(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: $(SRCDIR)/%.c
mkdir -p $(BUILDDIR); $(CC) $(CFLAGS) -c $< -o $@
+# Use "clean" to delete build and target files. Tell make that "clean"
+# is a "phony" target, i.e. this is not about building a file.
.PHONY: clean
clean:
rm $(OBJECTS)
.PHONY: clean
clean:
rm $(OBJECTS)