-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (63 loc) · 2.16 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# This is a temporary make file that we are not the author of
# Based From: https://www.cs.swarthmore.edu/~newhall/unixhelp/howto_makefiles.html
#
# TODO(Connor): Replace make file with our own version
#
# 'make depend' uses makedepend to automatically generate dependencies
# (dependencies are added to end of Makefile)
# 'make' builds for default linux
# 'make clean' removes all .o and executable files
#
# define the C compiler to use
CC = g++
# define default make file location
DEFAULT_MAKE = linux
# define the executable location
WIN_DIR = bin
LINUX_DIR = bin
OSX_DIR = bin
# define the executable file
MAIN = abacus
# define libraries
WIN_LIBS =
LINUX_LIBS = -lX11
OSX_LIBS =
# define any compile-time flags
CFLAGS = -Wno-narrowing -DTRIANGLE_WINDING_CCW
# OS Specific compile-time flags
WIN_CFLAGS = -DOS_WIN32
LINUX_CFLAGS = -DOS_LINUX
OSX_CFLAGS = -DOS_OSX
# define the general source files
SRCS = main.cpp render_backend.cpp render.cpp
# OS Specific Source files
WIN_SRCS =
LINUX_SRCS = linux_platform.cpp
OSX_SRCS =
WIN_OBJS = $(SRCS:.c=.o) $(WIN_SRCS:.c=.o)
LINUX_OBJS = $(SRCS:.c=.o) $(LINUX_SRCS:.c=.o)
OSX_OBJS = $(SRCS:.c=.o) $(OSX_SRCS:.c=.o)
#
# 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: $(DEFAULT_MAKE)
win32: $(WIN_OBJS)
$(CC) $(CFLAGS) $(WIN_CFLAGS) -o $(WIN_DIR)\$(MAIN).exe $(WIN_OBJS) $(WIN_LIBS)
linux: $(LINUX_OBJS)
$(CC) $(CFLAGS) $(LINUX_CFLAGS) -o $(LINUX_DIR)/$(MAIN) $(LINUX_OBJS) $(LINUX_LIBS)
osx: $(OSX_OBJS)
$(CC) $(CFLAGS) $(OSX_CFLAGS) -o $(OSX_DIR)/$(MAIN) $(OSX_OBJS) $(OSX_LIBS)
# 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) $(INCLUDES) -c $< -o $@
clean:
$(RM) *.o *~ $(MAIN)
depend: $(SRCS)
makedepend $(INCLUDES) $^
# DO NOT DELETE THIS LINE -- make depend needs it