pos/database/Makefile

58 lines
1.5 KiB
Makefile

# POS
CXX = @g++
ifndef NDEBUG
CXXFLAGS = -g -O0 -Wall -I/users/m4burns/thrift/include/thrift -I. -Igen-cpp
else
CXXFLAGS = -O3 -fexpensive-optimizations -ffast-math -fno-math-errno -Wall -I/users/m4burns/thrift/include/thrift -I. -Igen-cpp
endif
LDFLAGS = /users/m4burns/thrift/lib/libthriftnb.a /users/m4burns/thrift/lib/libthrift.a -levent
SOURCES = ConfigFile.cpp db.cpp db_if.cpp linus_sha1.c log.cpp nameserver.cpp sha1.cpp gen-cpp/pos_constants.cpp gen-cpp/Pos.cpp gen-cpp/pos_types.cpp
CPPOBJECTS = $(patsubst %.cpp,%.o,$(SOURCES))
OBJECTS = $(patsubst %.c,%.o,$(CPPOBJECTS))
CPPDEPS = $(patsubst %.cpp,%.d,$(SOURCES))
DEPS = $(patsubst %.c,%.d,$(CPPDEPS))
SERVER = server
CLIENT = client
DUMP = dump
##################################################################
.PHONY : all clean
all : $(SERVER) $(CLIENT) $(DUMP)
%.d : %.cpp
$(CXX) -MM $(CXXFLAGS) $^ > $@
%.d : %.c
$(CXX) -MM $(CXXFLAGS) $^ > $@
ifneq ($(MAKECMDGOALS),clean)
-include $(DEPS)
endif
%.o : %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o : %.c
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(SERVER) : $(OBJECTS) gen-cpp/Pos_server.skeleton.o
$(CXX) $(CXXFLAGS) $(OBJECTS) gen-cpp/Pos_server.skeleton.o -o $@ $(LDFLAGS)
$(CLIENT) : $(OBJECTS) client.o
$(CXX) $(CXXFLAGS) $(OBJECTS) client.o -o $@ $(LDFLAGS)
$(DUMP) : $(OBJECTS) dump.o
$(CXX) $(CXXFLAGS) $(OBJECTS) dump.o -o $@ $(LDFLAGS)
#################################################################
clean :
rm -f *.o gen-cpp/*.o $(SERVER) $(CLIENT) *.d gen-cpp/*.d