KissCount/Makefile

90 lines
2.2 KiB
Makefile

#ROOT_DIR="/usr"
ROOT_DIR="."
LIB_DIR=$(DESTDIR)$(ROOT_DIR)"/lib/kisscount/"
SHARE_DIR=$(DESTDIR)$(ROOT_DIR)"/share/kisscount/"
DOC_DIR=$(DESTDIR)$(ROOT_DIR)"/share/doc/kisscount/"
BIN_DIR=$(DESTDIR)$(ROOT_DIR)"/bin/"
CXX=$(HOST)g++
KISSCOUNT=kc
QT_PACKAGES="Qt5Core Qt5Gui Qt5Sql Qt5Xml Qt5Widgets"
CXXFLAGS+=`pkg-config --cflags $(QT_PACKAGES)`
CXXFLAGS+=-Wall -Isrc -Isrc/win32 -I${PWD}/lib/qt5charts/usr/include/x86_64-linux-gnu/qt5/ -L${PWD}/lib/qtcharts/lib/ -L${PWD}/lib/qt5charts/usr/lib/x86_64-linux-gnu/
ifdef WIN32
CXXFLAGS+=-DRESOURCES_ROOT="\"./resources/\"" -static
else
CXXFLAGS+=-DRESOURCES_ROOT="\"$(SHARE_DIR)\"" -ggdb -fPIC -O0
endif
SOURCES=$(shell find src -name '*.cpp' -type f | tr '\n' ' ')
OBJS=$(SOURCES:.cpp=.o)
MOC_HEADERS=$(shell find src/view -name '*.hpp' -type f | tr '\n' ' ')
MOCS=$(MOC_HEADERS:.hpp=.objs)
MOCS_OBJS=$(MOC_HEADERS:.hpp=.moc)
ifndef WIN32
LDFLAGS+=`pkg-config --libs $(QT_PACKAGES)`
LDFLAGS+=-lofx -lQt5Charts
else
LDFLAGS+=lib_mingw_32/QtCore4.dll lib_mingw_32/QtGui4.dll lib_mingw_32/QtSql4.dll lib_mingw_32/QtXml4.dll
endif
all: mojito $(KISSCOUNT)
clean_all: clean clean_libkdchart
clean:
find src -type f -name '*.o' -delete
find src -type f -name '*~' -delete
find src -type f -name '*.moc' -delete
find src -type f -name '*.objs' -delete
rm -f $(KISSCOUNT)
%.o : %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
%.objs : %.moc
$(CXX) $(CXXFLAGS) -x c++ $< -c -o $@
%.moc : %.hpp
moc -nw $< -o $@
%.moc : %.h
moc -nw $< -o $@
mojito : $(MOCS_OBJS)
$(KISSCOUNT): $(MOCS) $(OBJS)
$(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
clean_libkdchart:
rm -rf lib/libkdchart.a
find lib/libkdchart -name '*.o' -delete
find lib/libkdchart -type f -name '*.moc' -delete
find lib/libkdchart -type f -name '*.objs' -delete
generate_locales:
./tools/generate_locales.sh
ifdef WIN32
package:
./tools/package_win32.sh
else
package:
./tools/package.sh
endif
install:
mkdir -p $(BIN_DIR) $(SHARE_DIR) $(DOC_DIR)
cp $(KISSCOUNT) $(BIN_DIR)
cp -rf resources/* $(SHARE_DIR)
rm -rf $(SHARE_DIR)/po/* # Only copy qm files
cp -rf resources/po/*.qm $(SHARE_DIR)/po/
cp -rf README* ChangeLog AUTHORS COPYING TODO $(DOC_DIR)
remove:
rm -rf $(LIB_DIR) $(SHARE_DIR) $(DOC_DIR) $(BIN_DIR)/kc
uninstall: remove