-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (27 loc) · 784 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
.PHONY: clean run all
CC=gcc
CFLAGS=-c -Wall -g
LDFLAGS=-lpanel -lmenu -lcurses
SOURCES=map.c game.c high_score.c engine.c
vpath %.h src
vpath %.c src
vpath %.o Zbin
BUILDDIR=Zbin
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=zzzzzzzzzzzz
all: $(BUILDDIR)/$(EXECUTABLE)
$(BUILDDIR)/$(EXECUTABLE): $(OBJECTS)
@cd $(BUILDDIR); $(CC) $(LDFLAGS) $(OBJECTS) -o $(EXECUTABLE)
map.o: map.c map.h defs.h
@if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi
@$(CC) $(CFLAGS) $< -o $(BUILDDIR)/$@
game.o: game.c game.h defs.h
@$(CC) $(CFLAGS) $< -o $(BUILDDIR)/$@
high_score.o: high_score.c high_score.h defs.h
@$(CC) $(CFLAGS) $< -o $(BUILDDIR)/$@
engine.o: engine.c engine.h defs.h
@$(CC) $(CFLAGS) $< -o $(BUILDDIR)/$@
clean:
@rm -rf $(BUILDDIR)
run:
@cd $(BUILDDIR); ./$(EXECUTABLE)