source: trunk/Makefile

Last change on this file was 7, checked in by willem, 9 years ago

willem

File size: 4.2 KB
Line 
1
2###
3#   Copyright 2013 Willem Vermin, SURFsara
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16###
17include Make.inc
18CGI_PROGRAMS       = stoposserver
19CLIENT_PROGRAMS    = stoposclient stoposzztostr
20CLIENT_PROGRAMS1   = stoposdump
21OTHER_PROGRAMS     = testpool
22
23STOPOSSERVER_OBJS  := stoposserver.o stopos_pool.o stopos_key.o
24STOPOSSERVER_LIBS  := libwutils.a
25
26TESTPOOL_OBJS      := test_pool.o stopos_pool.o stopos_key.o clocks.o
27TESTPOOL_LIBS      := libwutils.a
28
29ifdef MAKE_GDBM
30  COMPILE_FLAGS     += -DMAKE_GDBM
31  STOPOSSERVER_OBJS +=  gdbm_pool.o
32  STOPOSSERVER_LIBS += -lgdbm
33  TESTPOOL_OBJS     +=  gdbm_pool.o
34  TESTPOOL_LIBS     += -lgdbm
35endif
36ifdef MAKE_FLAT
37  COMPILE_FLAGS     += -DMAKE_FLAT
38  STOPOSSERVER_OBJS +=  flatfile_pool.o
39  TESTPOOL_OBJS     +=  flatfile_pool.o
40endif
41ifdef MAKE_FILES
42  COMPILE_FLAGS     += -DMAKE_FILES
43  STOPOSSERVER_OBJS +=  files_pool.o
44  TESTPOOL_OBJS     +=  files_pool.o
45endif
46ifdef MAKE_MYSQL
47  COMPILE_FLAGS     += -DMAKE_MYSQL
48  STOPOSSERVER_OBJS +=  mysql_pool.o
49  STOPOSSERVER_LIBS += -lmysqlcppconn
50  TESTPOOL_OBJS     +=  mysql_pool.o
51  TESTPOOL_LIBS     += -lmysqlcppconn
52endif
53
54COMPILE_FLAGS += -D$(DB_DEFAULT)
55
56COMPILE_FLAGS += -DSERVER_URL=\"$(SERVER_URL)\"
57
58COMPILE_FLAGS += -DDB_DIR=\"$(DB_DIR)\"
59
60STOPOSCLIENT_OBJS  = stoposclient.o wrequest.o shellenv.o
61STOPOSCLIENT_LIBS  = -lcurl libwutils.a
62
63
64STOPOSZZTOSTR_OBJS = stoposzztostr.o
65STOPOSZZTOSTR_LIBS = libwutils.a -lz
66
67PROGRAMS           = $(CGI_PROGRAMS) $(CLIENT_PROGRAMS) $(OTHER_PROGRAMS)
68
69CGI_LIBS           = 
70CGI_INC            = 
71
72all: $(PROGRAMS)
73
74CGI_OBJS           = $(STOPOSSERVER_OBJS)
75CGI_SRCS           = $(CGI_OBJS:.o=.cpp)
76
77CLIENT_OBJS        = $(STOPOSCLIENT_OBJS)
78CLIENT_SRCS        = $(CLIENT_OBJS:.o=.cpp)
79
80OTHER_OBJS         = $(TESTPOOL_OBJS)
81OTHER_SRCS         = $(OTHER_OBJS:.o=.cpp)
82
83SRCS = $(sort $(CGI_SRCS) $(OTHER_SRCS) $(CLIENT_SRCS) wutils.cpp)
84
85stoposserver: $(STOPOSSERVER_OBJS) libwutils.a
86        $(CXX) -o $@ $(CXXFLAGS) $(STOPOSSERVER_OBJS) $(STOPOSSERVER_LIBS)
87
88stoposclient: $(STOPOSCLIENT_OBJS) libwutils.a
89        $(CXX) -o $@ $(CXXFLAGS) $(STOPOSCLIENT_OBJS) $(STOPOSCLIENT_LIBS)
90
91testpool:  $(TESTPOOL_OBJS) libwutils.a
92        $(CXX) -o $@ $(CXXFLAGS) $(TESTPOOL_OBJS) $(TESTPOOL_LIBS)
93
94stoposzztostr: $(STOPOSZZTOSTR_OBJS) libwutils.a
95        $(CXX) -o $@ $(CXXFLAGS) $(STOPOSZZTOSTR_OBJS) $(STOPOSZZTOSTR_LIBS)
96
97libwutils.a: wutils.o
98        ar -r $@ wutils.o
99
100stopos.1: stopos.man
101        sed 's"DEFAULTSERVERURL"$(SERVER_URL)"' stopos.man > $@
102
103%.o:    %.cpp
104        $(CXX) $(CXXFLAGS) $(COMPILE_FLAGS) $(CGI_INC) -c -o $@ $<
105
106include .depend
107
108.depend dep:
109        $(CXX) -M $(SRCS) $(CGI_INC) > .depend
110
111clean:
112        rm -f *.o libwutils.a $(PROGRAMS) stopos.1 .depend
113
114realclean: clean
115
116install: install_cgi install_client install_module install_remote
117       
118install_cgi:    $(CGI_PROGRAMS)
119        mkdir -p $(CGI_INSTALL_DIR)
120        install $(CGI_PROGRAMS) $(CGI_INSTALL_DIR)
121
122install_client: $(CLIENT_PROGRAMS) $(CLIENT_PROGRAMS1) stopos.1
123        mkdir -p $(CLIENT_INSTALL_DIR)/bin
124        install $(CLIENT_PROGRAMS) $(CLIENT_PROGRAMS1) $(CLIENT_INSTALL_DIR)/bin
125        mkdir -p $(CLIENT_INSTALL_DIR)/man/man1
126        install stopos.1 -m 644 $(CLIENT_INSTALL_DIR)/man/man1
127        install sara-get-mem-size $(CLIENT_INSTALL_DIR)/bin
128        install sara-get-num-cores $(CLIENT_INSTALL_DIR)/bin
129        install sara-get-mem-size.1 -m 644 $(CLIENT_INSTALL_DIR)/man/man1
130        install sara-get-num-cores.1 -m 644 $(CLIENT_INSTALL_DIR)/man/man1
131
132install_module:
133        mkdir -p $(MODULE_INSTALL_DIR)/mystopos
134        install modulefile -m 644 $(MODULE_INSTALL_DIR)/mystopos/$(STOPOS_VERSION)
135
136install_remote: $(CLIENT_PROGRAMS) $(CGI_PROGRAMS)
137        chmod 755 $(CLIENT_PROGRAMS) $(CGI_PROGRAMS)
138        @echo "Now, manually transport"
139        @echo "$(CLIENT_PROGRAMS) to $(REMOTE_CLIENT_INSTALL_DIR)"
140        @echo "and"
141        @echo "$(CGI_PROGRAMS) to $(REMOTE_CGI_INSTALL_DIR)"
142
Note: See TracBrowser for help on using the repository browser.