-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
126 lines (106 loc) · 3 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#==============================================================================
# This is a generic makefile that you may use to build an application or plugin
# module which utilizes Crystal Space. It relies upon the `cs-config' utility
# script, which is installed along with the Crystal Space SDK, to determine
# build flags needed to incorporate Crystal Space into your project.
#
# You will need to edit this makefile template so it is suitable for your
# project. You may need to change at least the following variables after
# copying this template makefile into your project:
#
# TARGET_TYPE -- either `exe' or `plugin'
# TARGET_NAME -- name of the executable or plugin (sans .exe, .dll)
# SRC -- all source files comprising your program or plugin
# LINKFLAGS -- linker flags and libraries that your project requires
# VERSION -- product version number
# RELEASE_DATE -- date of product release
#
# If you installed Crystal Space in a non-standard location, then you will also
# need to set the CRYSTAL environment variable to point at the root of the
# installed SDK.
#
# This makefile supports the following targets: all, clean, depend.
#==============================================================================
VERSION = 1.0
RELEASE_DATE = 01-Jan-2005
SRCDIR = .
#------
# Type of project: `exe' or `plugin'
#------
TARGET_TYPE = exe
#TARGET_TYPE = plugin
#------
# Name of program or plugin
#------
TARGET_NAME = map2cs
ifeq ($(TARGET_TYPE),exe)
TARGET=$(TARGET_NAME)$(EXE)
else
TARGET=$(TARGET_NAME)$(DLL)
endif
#------
# Location of sources and object files
#------
SRC=$(wildcard *.cpp)
OBJS=$(addsuffix .o, $(basename $(SRC)))
OUT=.
#------
# Tools to use
#------
CXX=g++
LINK=$(CXX)
RM=rm -rf
#------
# Abstractions
#------
LFLAGS.L = -L
LFLAGS.l = -l
CFLAGS.D = -D
CFLAGS.I = -I
#------
# Flags for compiler and linker.
# Make sure to update the required libraries for your own project
#------
CFLAGS := $(shell cs-config --cflags) -g
CXXFLAGS := $(shell cs-config --cxxflags) -g -DCS_DEBUG -Iinclude
LINKFLAGS := $(shell cs-config --libs crystalspace) -g
DO.SHARED.PLUGIN.CORE=$(LINK) $(LFLAGS.DLL) -o $@ $^ $(PLUGIN.POSTFLAGS)
DO.PLUGIN = \
$(DO.SHARED.PLUGIN.PREAMBLE) \
$(DO.SHARED.PLUGIN.CORE) $(LINKFLAGS) \
$(DO.SHARED.PLUGIN.POSTAMBLE)
DO.EXE = $(LINK) -o $@ $^ $(LFLAGS.EXE) $(LINKFLAGS) $(LIBS.EXE.PLATFORM)
ifeq ($(TARGET_TYPE),exe)
DO.TARGET = $(DO.EXE)
else
DO.TARGET = $(DO.PLUGIN)
endif
CSCONFIG.MAK=csconfig.mak
-include $(CSCONFIG.MAK)
#------
# Rules
#------
.PHONY: all depend clean
.SUFFIXES: .cpp
.cpp.o: $<
$(CXX) $(CXXFLAGS) -o $@ -c $<
all: $(CSCONFIG.MAK) $(TARGET)
$(TARGET): $(OBJS)
$(DO.TARGET)
clean:
$(RM) $(TARGET) $(TARGET).app $(OBJS) $(CSCONFIG.MAK) \
makefile.dep *.def
#------
# Create dependencies
#------
depend: $(CSCONFIG.MAK)
gcc -MM $(CXXFLAGS) $(SRC) > makefile.dep
#------
# Re-create the config flags include file
#------
$(CSCONFIG.MAK):
cs-config --makevars > $(CSCONFIG.MAK)
#------
# Include dependencies
#------
-include makefile.dep