-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.linux
156 lines (96 loc) · 3.41 KB
/
Makefile.linux
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
include Makefile.common
distro = $(shell /bin/sh getdistro)
buildno =$(shell /bin/sh newbuild)
release = $(shell /bin/sh cat release)
arch = $(shell uname -i)
version = $(shell /bin/sh getversion)
MSUFFIX = linux
CC = $(CCCMD) $(OSDEFINES)
#CXX = $(CC)
MAKEFILE = Makefile.$(MSUFFIX)
GPROF= #-pg
# use make BITS=-m32 to build 32 bit
OSDEFINES = -D_OS_LINUX -D_CC_GCC $(BITS) $(INSTALLDIR)
SUPPORTLIBS = lib/libaikidonetwork.so lib/libaikidomath.so \
lib/libaikidonetwork.a lib/libaikidomath.a
LDLIBS += -rdynamic $(LIB) -lpthread -ldl -lstdc++ -lm
CPPFLAGS += -Isrc -Isrc/pcre $(OSDEFINES) $(DEBUG)
CPPFLAGS += -Isrc -Isrc/pcre $(OSDEFINES) $(DEBUG) $(GPROF) -fPIC
LDFLAGS += -L.
build: xdebug xgtk midclean xopt
AIKIDOZIP = aikido_zip.o
AIKIDOZIPC = aikido_zip.cc
$(ZIPFILE):
cd src ; $(ZIPCMD) ../$(ZIPFILE) $(ZIPFILES)
cd src/gtk ; $(ZIPCMD) ../../$(ZIPFILE) $(GTKFILES)
$(AIKIDOZIP): $(ZIPFILE)
echo 'extern "C" {' > $(AIKIDOZIPC)
xxd -i $(ZIPFILE) >> $(AIKIDOZIPC)
echo '}' >> $(AIKIDOZIPC)
$(CXX) -c $(CXXFLAGS) -o $(AIKIDOZIP) $(AIKIDOZIPC)
rm -f $(ZIPFILE)
xdebug:
$(MAKE) -f $(MAKEFILE) DEBUG="-g -DDEBUGON" LIB=$(GLIB) BIN=$(GBIN) STATICLIB=$(GSTATICLIB) $(GBIN)
xopt:
$(MAKE) -f $(MAKEFILE) DEBUG=-O3 LIB=$(OLIB) BIN=$(OBIN) STATICLIB=$(OSTATICLIB) $(OBIN)
xgtk:
-$(MAKE) -f $(MAKEFILE) DEBUG="-g -w" gtk
driver: driver.o
$(CC) -o $(DRIVER) driver.o -lstdc++
//OBJS += network.o math.o
$(LIB) : $(OBJS)
ar ruv $(LIB) $(AIKIDOZIP) $(OBJS)
gcc $(BITS) -Wl,-r -nostdlib -o $(STATICLIB) $(OBJS)
$(BIN): $(AIKIDOZIP) $(LIB) $(EOBJS) $(SUPPORTLIBS)
$(LINK.cc) -o $(BIN) $(PROFILE) $(EOBJS) $(LDLIBS) $(GPROF)
bin/mkelf: src/mkelf.cc
$(CC) -o bin/mkelf src/mkelf.cc -lstdc++
lib/libaikidonetwork.so : network.o
$(CC) -shared -o lib/libaikidonetwork.so network.o -lnsl -lstdc++
lib/libaikidonetwork.a: network.o
$(AR) ruv lib/libaikidonetwork.a network.o
network.o : src/network.cc
$(CC) $(CPPFLAGS) -Isrc -o network.o -c src/network.cc -fPIC
lib/libaikidomath.so : math.o
$(CC) -shared -o lib/libaikidomath.so math.o -lstdc++
lib/libaikidomath.a : math.o
$(AR) ruv lib/libaikidomath.a math.o
math.o : src/math.cc
$(CC) $(CPPFLAGS) -Isrc -o math.o -c src/math.cc -fPIC
lib/libaikidosecurity.so : security.o
$(CC) -shared -o lib/libaikidosecurity.so security.o -lcrypt -lstdc++
lib/libaikidosecurity.a : security.o
$(AR) ruv lib/libaikidosecurity.a security.o
security.o : src/security.cc
$(CC) $(CPPFLAGS) -Isrc -o security.o -c src/security.cc -fPIC
#
# GTK+ support
#
gtk: lib/libdtk.so lib/libddk.so
lib/libdtk.so : dtk.o
$(CC) -shared -o lib/libdtk.so dtk.o -lstdc++
dtk.o : src/gtk/dtk.cc
$(CC) $(CPPFLAGS) -Isrc $(GTKINC) $(GLIBINC) -w -o dtk.o -c src/gtk/dtk.cc -fPIC
ddk.o : src/gtk/ddk.cc
$(CC) $(CPPFLAGS) -Isrc $(GTKINC) $(GLIBINC) -w -o ddk.o -c src/gtk/ddk.cc -fPIC
lib/libddk.so : ddk.o
$(CC) -shared -o lib/libddk.so ddk.o -lstdc++
.PHONY: aikido.spec
aikido.spec: aikido.spec.in
sed -e 's!%%root%%!$(PWD)!g' -e 's!%%distro%%!$(distro)!g' \
-e 's!%%build%%!$(buildno)!g' \
-e 's!%%arch%%!$(arch)!g' \
-e 's!%%version%%!$(version)!g' $< >$@
rpmbuild := $(shell which rpmbuild 2>/dev/null || which rpm)
rpm: aikido.spec
$(rpmbuild) -bb $<
qrpm: aikido.spec
$(rpmbuild) -bb --define 'no_build 1' $<
clean:
rm -f *.o $(GLIB) $(GBIN) $(OLIB) $(OBIN) $(ZIPFILE) $(SUPPORTLIBS)
#
# clean for swap from debug to optimize build
#
midclean:
rm -f *.o
.WAIT: