annotate Makefile.gen @ 62:baccf2044289

Move the OpenGL rendering, setup etc. into a separate module/class, perhaps facilitating other types of renderers in future .. maybe.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 14 Dec 2019 16:39:20 +0200
parents 7b138613e2fc
children 03aa729a9e90
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42
3c7e1d3fa5a2 Implement OpengL extension handling through new header file dmglexts.h to
Matti Hamalainen <ccr@tnsp.org>
parents: 41
diff changeset
1 CXXFLAGS += -O3 -W -Wall -std=c++11
3c7e1d3fa5a2 Implement OpengL extension handling through new header file dmglexts.h to
Matti Hamalainen <ccr@tnsp.org>
parents: 41
diff changeset
2 LDFLAGS +=
40
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
3 CXXFLAGS += $(SDL_CFLAGS) $(GL_CFLAGS)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
4
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
5 MKDIR ?= mkdir
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
6 MKDIR_P ?= $(MKDIR) -p
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
7 BINPATH ?= ./
34
c0b85b0615d2 Improve the makefiles.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
40
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
9 ifneq ($(V),1)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
10 COMPILE_C_OBJ = @if test ! -d $(OBJPATH); then $(MKDIR_P) $(OBJPATH); fi && echo " CC $<" && $(CC) $(CFLAGS) -c -o $@ $<
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
11 COMPILE_CXX_OBJ = @if test ! -d $(OBJPATH); then $(MKDIR_P) $(OBJPATH); fi && echo " CXX $<" && $(CXX) $(CXXFLAGS) -c -o $@ $<
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
12 LINK_C_BIN = @if test ! -d $(BINPATH); then $(MKDIR_P) $(BINPATH); fi && echo " LINK $@" && $(CC) -o $@ $(filter %.o %.a,$+)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
13 LINK_CXX_BIN = @if test ! -d $(BINPATH); then $(MKDIR_P) $(BINPATH); fi && echo " LINK $@" && $(CXX) -o $@ $(filter %.o %.a,$+)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
14 LINK_STATIC_LIB = @echo " AR $@" && $(AR) cru $@ $(filter %.o,$+) && $(RANLIB) $@
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
15 else
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
16 COMPILE_C_OBJ = @if test ! -d $(OBJPATH); then $(MKDIR_P) $(OBJPATH); fi && echo "$(CC) $(CFLAGS) -c -o $@ $<" && $(CC) $(CFLAGS) -c -o $@ $<
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
17 COMPILE_CXX_OBJ = @if test ! -d $(OBJPATH); then $(MKDIR_P) $(OBJPATH); fi && echo "$(CXX) $(CXXFLAGS) -c -o $@ $<" && $(CXX) $(CXXFLAGS) -c -o $@ $<
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
18 LINK_C_BIN = @if test ! -d $(BINPATH); then $(MKDIR_P) $(BINPATH); fi && echo "$(CC) -o $@ $(filter %.o %.a,$+)" && $(CC) -o $@ $(filter %.o %.a,$+)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
19 LINK_CXX_BIN = @if test ! -d $(BINPATH); then $(MKDIR_P) $(BINPATH); fi && echo "$(CXX) -o $@ $(filter %.o %.a,$+)" && $(CXX) -o $@ $(filter %.o %.a,$+)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
20 LINK_STATIC_LIB = @echo "$(AR) cru $@ $(filter %.o,$+)" && $(AR) cru $@ $(filter %.o,$+) && echo "$(RANLIB) $@" && $(RANLIB) $@
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
21 endif
34
c0b85b0615d2 Improve the makefiles.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22
41
eaa3e8575c12 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
23 BINARIES = gldragon ply2bin
eaa3e8575c12 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
24
eaa3e8575c12 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
25 TARGETS += \
eaa3e8575c12 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
26 $(addprefix $(BINPATH),$(addsuffix $(BINEXT),$(BINARIES)))
eaa3e8575c12 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
27
eaa3e8575c12 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
28 NOBUILD_TARGETS +=
eaa3e8575c12 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
29 NOINST_TARGETS +=
eaa3e8575c12 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
30 CLEAN_TARGETS +=
eaa3e8575c12 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
31 DISTCLEAN_TARGETS +=
eaa3e8575c12 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
32
34
c0b85b0615d2 Improve the makefiles.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
40
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
34 ###
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
35 ### Target rules
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
36 ###
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
37 all: $(NOBUILD_TARGETS) $(NOINST_TARGETS) $(TARGETS)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
38
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
39
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
40 $(OBJPATH)%.o: %.cpp %.h
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
41 $(COMPILE_CXX_OBJ)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
42
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
43 $(OBJPATH)%.o: %.cpp
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
44 $(COMPILE_CXX_OBJ)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
45
34
c0b85b0615d2 Improve the makefiles.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
62
baccf2044289 Move the OpenGL rendering, setup etc. into a separate module/class, perhaps
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
47 $(BINPATH)gldragon$(BINEXT): $(addprefix $(OBJPATH), gldragon.o dmglrender.o dmscene.o dmutil.o)
40
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
48 $(LINK_CXX_BIN) $(LDFLAGS) $(SDL_LDFLAGS) $(GL_LDFLAGS)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
49
61
7b138613e2fc Rename dmmodel.* to dmscene.*
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
50 $(BINPATH)ply2bin$(BINEXT): $(addprefix $(OBJPATH), ply2bin.o dmscene.o dmutil.o)
40
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
51 $(LINK_CXX_BIN) $(LDFLAGS) $(TOOL_LDFLAGS)
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
52
34
c0b85b0615d2 Improve the makefiles.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53
40
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
54 ###
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
55 ### Special targets
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
56 ###
34
c0b85b0615d2 Improve the makefiles.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 clean:
40
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
58 -$(RM) $(TARGETS) $(NOINST_TARGETS) $(CLEAN_TARGETS) $(OBJPATH)*.o
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
59
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
60 distclean: clean
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
61 -$(RM) $(DISTCLEAN_TARGETS) *~ core *.core
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
62
6905d02bca2d Build system improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
63 .PHONY: clean distclean all