-
Notifications
You must be signed in to change notification settings - Fork 10
/
makefile.ng
194 lines (154 loc) · 4.35 KB
/
makefile.ng
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Makefile for building the libmgplus with GNU Make
# Useful for non-gcc compilers
# Use: make -f makefile.ng [options]
###############################################################################
# This is the top project directory
TOPPROJALL = 1
TOPLOOP=1
abs_top_srcdir=.
###############################################################################
# ------> Please changes to your own rules specific to platform. <------
TARGET_RULES=build/rules-mips.vxworks
include $(abs_top_srcdir)/$(TARGET_RULES)
######################################################################
files=
src_files=
# include source files
include files.ng
include source.ng
obj_files := $(src_files:.cpp=.o)
# set version
NAME=$(project_name)
LIB_NAME=$(lib_name)
LIB_MAJOR_VERSION=$(lib_major_version)
LIB_MINOR_VERSION=$(lib_minor_version)
LIB_MICRO_VERSION=$(lib_micro_version)
LIB_VERSION=$(LIB_MAJOR_VERSION).$(LIB_MINOR_VERSION).$(LIB_MICRO_VERSION)
LIB_SO_VERSION=$(LIB_MAJOR_VERSION).$(LIB_MINOR_VERSION).$(LIBSO).$(LIB_MICRO_VERSION).$(LIB_INTERFACE_AGE).$(LIB_BINARY_AGE)
LIB_SHORT=$(LIB_NAME).$(LIBSO)
LIB_MID=$(LIB_NAME).$(LIBSO).$(LIB_MAJOR_VERSION)
LIB_STATIC=$(LIB_NAME).$(LIBA)
LIB_SO=$(LIB_NAME).$(LIBSO).$(LIB_VERSION)
#################################################################################
# some default setting
DNAME=__MGPLUS_LIB__
ifndef PREFIX
PREFIX = /usr/local
endif
ifndef OBJ
OBJ=o
endif
ifndef ARFLAGS
ARFLAGS=-rc
endif
ifndef SOFLAGS
SOFLAGS=-fPIC -shared -o
endif
ifndef COFLAG
COFLAG=-c
endif
# Directories used by "make install":
EXEC_PREFIX = $(PREFIX)
BINDIR = $(EXEC_PREFIX)/bin
LIBDIR = $(EXEC_PREFIX)/lib
PCDIR = $(LIBDIR)/pkgconfig
INCLUDEDIR = $(PREFIX)/include
INCLIBDIR = $(INCLUDEDIR)/$(NAME)
DATADIR = $(PREFIX)/share
LOCALEDIR = $(DATADIR)/locale
MANDIR = $(DATADIR)/man
DOCDIR = $(DATADIR)/doc/$(NAME)
PC_LIBS = -l$(NAME)
PC_CFLAGS =
# Programs used by "make":
CP = cp -fH
CPR = cp -fHr
LN = ln -s
RM = rm -f
RMR = rm -fr
MKDIR = mkdir -p
######################################################################
# some deplibs flags
DEPLIBINC = -I$(PREFIX)/include
DEFS += -D$(DNAME) -D_REENTRANT
LOCALFLAGS = $(DEFS) -I$(abs_top_srcdir)/ -I$(abs_top_srcdir)/include -I$(abs_top_srcdir)/src/agg/ -I$(abs_top_srcdir)/src/agg/font_freetype
CFLAGS += $(LOCALFLAGS) $(DEPLIBINC) $(LOCAL_INC) $(DEPCFLAGS)
CXXFLAGS += $(LOCALFLAGS) $(DEPLIBINC) $(LOCAL_INC) $(DEPCFLAGS)
DEPLIBS = -L$(PREFIX)/lib
DEPLDFLAGS += `pkg-config --libs minigui`
LOCALLIBS =
LDFLAGS += $(LOCALLIBS) $(DEPLIBS) $(LOCAL_LIBS) $(DEPLDFLAGS)
################################################################
# specific targets and commands
# compile source files
%.$(OBJ): %.cpp
$(CXX) $(CXXFLAGS) $(COFLAG) $< $(SOFLAGS) $@
# create library
$(LIB_STATIC) $(LIB_SO): $(obj_files)
@-echo "begin create library -->"
ifdef LIBA
@-echo "begin create static library -->"
$(AR) $(ARFLAGS) $(ARFLAGS_OUT) $(LIB_STATIC) $(obj_files)
$(RANLIB) $@
@-echo "create static library done <--"
endif
ifdef LIBSO
@-echo "begin create shared library -->"
$(CC) $(LDFLAGS) $(SOFLAGS) $(LIB_SO) $(obj_files)
@-echo "create shared library done <--"
endif
@-echo "create library done <--"
# clean the compile files
.PHONY: clean
clean:
-$(RM) $(obj_files)
ifdef LIBA
-$(RM) $(LIB_STATIC)
endif
ifdef LIBSO
-$(RM) $(LIB_SO)
endif
@-echo "clean complete."
# install library
.PHONY: install
install:
@-echo "prefix is: $(PREFIX)"
@-echo "exec_prefix is: $(EXEC_PREFIX)"
@-echo "libdir is: $(LIBDIR)"
@-echo "MGUTILS_VERSION is: $(LIB_VERSION)"
@-echo "PC_LIBS is: $(PC_LIBS)"
@-echo "PC_CFLAGS is: $(PC_CFLAGS)"
@-$(MKDIR) $(PREFIX)
@-$(MKDIR) $(INCLUDEDIR)
@-$(MKDIR) $(INCLIBDIR)
@-$(MKDIR) $(LIBDIR)
@-$(MKDIR) $(PCDIR)
@-$(CPR) include/*.h $(INCLIBDIR)/
@-$(CP) mgplusconfig.h $(INCLIBDIR)/
@-$(CP) $(NAME).pc $(PCDIR)/
ifdef LIBA
$(CP) $(LIB_STATIC) $(LIBDIR)/$(LIB_STATIC)
endif
ifdef LIBSO
$(CP) $(LIB_SO) $(LIBDIR)/
$(RM) $(LIBDIR)/$(LIB_SHORT)
$(RM) $(LIBDIR)/$(LIB_MID)
$(LN) $(LIBDIR)/$(LIB_SO) $(LIBDIR)/$(LIB_SHORT)
$(LN) $(LIBDIR)/$(LIB_SO) $(LIBDIR)/$(LIB_MID)
endif
@-echo "install done."
#uninstall library
.PHONY: uninstall
uninstall:
@-$(RMR) $(INCLIBDIR)/*
@-$(RM) $(PCDIR)/$(NAME).pc
ifdef LIBA
$(RM) $(LIBDIR)/$(LIB_STATIC)
endif
ifdef LIBSO
$(RM) $(LIBDIR)/$(LIB_SHORT)
$(RM) $(LIBDIR)/$(LIB_MID)
$(RM) $(LIBDIR)/$(LIB_SO)
endif
@-echo "uninstall done."
force: