-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (38 loc) · 1.31 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Allegro 4.2.2 for DOS example
# MIT license
CC = $(DJGPP_CC)
VENDOR = vendor
CFLAGS = -DHAVE_STDBOOL_H=1 -fgnu89-inline -Ivendor/allegro-4.2.2-xc/include -Ivendor/allegTTF/include
LDFLAGS = -Lvendor/allegro-4.2.2-xc/lib/djgpp -lalleg -Lvendor/allegTTF/lib -lalttf
BIN = main.exe
SRCDIR = src
OBJDIR = obj
DISTDIR = dist
STATICDIR = static
# Static files, e.g. the readme.txt file, that get copied straight to
# the dist directory.
STATIC = $(shell find $(STATICDIR) -name "*.*" -not -name ".*" 2> /dev/null)
STATICDEST= $(subst $(STATICDIR),$(DISTDIR),$(STATIC))
# All source files (*.c) and their corresponding object files.
SRC = $(shell find $(SRCDIR) -name "*.c" 2> /dev/null)
OBJS = $(SRC:%.c=%.o)
.PHONY: clean static
default: all
# Check whether DJGPP is available.
ifndef DJGPP_CC
$(error To compile, you'll need to set the DJGPP_CC environment variable to a DJGPP GCC binary, e.g. /usr/local/djgpp/bin/i586-pc-msdosdjgpp-gcc)
endif
${DISTDIR}:
mkdir -p ${DISTDIR}
%.o: %.c
${CC} -c -o $@ $? ${CFLAGS}
${DISTDIR}/${BIN}: ${OBJS}
${CC} -o ${DISTDIR}/${BIN} $+ ${LDFLAGS}
${STATICDEST}:
@mkdir -p $(shell dirname $@)
cp $(subst $(DISTDIR),$(STATICDIR),$@) $@
all: ${DISTDIR} ${DISTDIR}/${BIN} ${STATICDEST}
static: ${STATICDEST}
clean:
rm -rf ${DISTDIR}
rm -f ${OBJS}