-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
34 lines (27 loc) · 951 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
CC = gcc
CFLAGS = -Wall -g
INCLUDES = include res
SRCS = $(shell find src/ -type f -name '*.c')
OBJS = $(SRCS:.c=.o)
MAIN = bin/pxbm
#
# The following part of the makefile is generic; it can be used to
# build any executable just by changing the definitions above and by
# deleting dependencies appended to the file from 'make depend'
#
.PHONY: depend clean
all: $(MAIN)
@echo pxbm has been compiled successfully
$(MAIN): $(OBJS)
@mkdir -p bin
$(CC) $(CFLAGS) $(addprefix -I, $(INCLUDES)) -o $(MAIN) $(OBJS)
# this is a suffix replacement rule for building .o's from .c's
# it uses automatic variables $<: the name of the prerequisite of
# the rule(a .c file) and $@: the name of the target of the rule (a .o file)
# (see the gnu make manual section about automatic variables)
.c.o:
$(CC) $(CFLAGS) $(addprefix -I, $(INCLUDES)) -c $< -o $@
clean:
$(RM) $(OBJS) *~ $(MAIN)
depend: $(SRCS)
makedepend $(INCLUDES) $^