-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (40 loc) · 1.48 KB
/
Makefile
File metadata and controls
57 lines (40 loc) · 1.48 KB
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
#----------------------------------------------------------------
# Platform-specific build tools
#----------------------------------------------------------------
CC := g++
OBJSUFFIX := .o
LIBPREFIX := lib
STATIC_LIBSUFFIX := .a
#----------------------------------------------------------------
# Static Library Variables
#----------------------------------------------------------------
SGLDIR := ../libsgl
STDIR := ../libst
SGLLIB := $(addsuffix $(STATIC_LIBSUFFIX), sgl)
SGLLIB := $(addprefix $(LIBPREFIX), $(SGLLIB))
SGLLIB := $(SGLDIR)/lib/$(SGLLIB)
STLIB := $(addsuffix $(STATIC_LIBSUFFIX), st)
STLIB := $(addprefix $(LIBPREFIX), $(STLIB))
STLIB := $(STDIR)/lib/$(STLIB)
#----------------------------------------------------------------
# Compiler and Linker flags
#----------------------------------------------------------------
INCLUDE_DIRS := $(STDIR)/include $(SGLDIR)
INCLUDE_DIRS := $(addprefix -I, $(INCLUDE_DIRS))
CFLAGS := $(INCLUDE_DIRS)
LIBS := glut st sgl png jpeg
LIBS := $(addprefix -l, $(LIBS))
LD_FLAGS := -L$(STDIR)/lib -L$(SGLDIR)/lib $(LIBS)
#----------------------------------------------------------------
# Dependencies
#----------------------------------------------------------------
all: make_sgl assignment2
# Invoke sgl Makefile (which in turn invokes st makefile)
make_sgl:
@(cd $(SGLDIR); make)
assignment2: main.o $(SGLLIB) $(STLIB)
$(CC) -o $@ $(LD_FLAGS) $^
main.o: main.cpp
$(CC) $(CFLAGS) -o $@ -c $^
clean:
rm -rf *~ *.o assignment2 \#*