qasim/Makefile

181 lines
3.5 KiB
Makefile
Raw Normal View History

2011-07-29 11:45:58 +00:00
NAME=qasim
2014-05-19 07:51:12 +00:00
DESTDIR=
2014-04-03 22:36:18 +00:00
DEV_DESTDIR=tmp
CONFDIR=$(DESTDIR)/etc
2014-05-19 07:51:12 +00:00
BINDIR=$(DESTDIR)/usr/bin
MANDIR=$(DESTDIR)/usr/share/man
DOCDIR=$(DESTDIR)/usr/share/doc
SHAREDIR=$(DESTDIR)/usr/share
2014-05-09 06:35:40 +00:00
RUBYVERSION=2.0
RDOC=rdoc$(RUBYVERSION)
2012-07-28 14:34:35 +00:00
all: \
build \
install
2012-07-28 14:34:35 +00:00
clean: \
clean-ui \
clean-qrc \
clean-bin \
clean-lib \
clean-data \
clean-doc
2012-07-28 14:34:35 +00:00
build: \
build-ui \
build-qrc \
build-bin \
build-lib \
build-data
doc: build-doc
2012-07-28 14:34:35 +00:00
install: \
install-ui \
install-qrc \
install-bin \
install-lib \
install-data
## DOC SECTION
.PHONY: build-doc
2012-07-28 14:34:35 +00:00
clean-doc:
rm -fr doc
2012-07-28 14:34:35 +00:00
build-doc: clean-doc
$(RDOC) \
--promiscuous \
--inline-source \
--line-numbers \
2012-07-28 14:34:35 +00:00
-o doc lib/$(NAME)/ \
2011-07-29 11:45:58 +00:00
bin/
# --diagram
install-doc:
# # install documentation
rm -fr $(DOCDIR)/$(NAME)
mkdir -p $(DOCDIR)/$(NAME)
cp -a doc $(DOCDIR)/$(NAME)
2012-07-28 14:34:35 +00:00
## QRC -> QRC_RB SECTION
QRC_FILES=$(wildcard lib/$(NAME)/*.qrc)
RBQRC_FILES=$(patsubst %.qrc,%_qrc.rb,$(QRC_FILES))
clean-qrc:
rm -f $(RBQRC_FILES)
build-qrc: $(RBQRC_FILES)
echo $(RBQRC_FILES)
install-qrc: $(RBQRC_FILES)
# FIXME install qrc
%_qrc.rb: %.qrc
rbrcc $< -o $@
## UI -> UI_RB SECTION
UI_FILES=$(wildcard lib/$(NAME)/ui/*.ui)
RBUI_FILES=$(patsubst %.ui,%_ui.rb,$(UI_FILES))
clean-ui:
rm -f $(RBUI_FILES)
build-ui: $(RBUI_FILES)
echo $(RBUI_FILES)
install-ui: $(RBUI_FILES)
# FIXME install
%_ui.rb: %.ui
2014-05-09 06:22:24 +00:00
rbuic4 $< -o $@
2012-08-02 09:10:25 +00:00
sed -e '/^module Ui/,/^end # module Ui/d' \
2012-07-30 17:31:39 +00:00
-i $@
2012-07-28 14:34:35 +00:00
## BINARY SECTION
clean-bin:
# remove external packages
rm -fr vendor/bundle
build-bin:
install-bin:
2014-05-19 07:51:12 +00:00
env |sort
mkdir -p $(BINDIR)
for binfile in bin/*.rb ; do \
BINFILE=`basename $$binfile |sed -e 's/.rb$$//'`; \
install -D -o root -g root -m 755 $$binfile $(BINDIR)/$$BINFILE; \
2013-06-21 12:25:03 +00:00
sed -i -e 's|^QASIM_INCLUDE_DIR.*|QASIM_INCLUDE_DIR = "$(SHAREDIR)/$(NAME)/lib"|' $(BINDIR)/$$BINFILE; \
sed -i -e 's|^QASIM_DATA_DIR.*|QASIM_DATA_DIR = "$(SHAREDIR)/$(NAME)"|' $(BINDIR)/$$BINFILE; \
done
#install -D -o root -g root -m 755 $(CURDIR)/bin/$(NAME)-gui.rb $(BINDIR)/$(NAME)-gui
2012-07-28 14:34:35 +00:00
## LIB SECTION
clean-lib:
build-lib:
2012-07-28 14:34:35 +00:00
install-lib:
IFS="" find lib -name '*.rb' | while read libfile ; do \
install -D -o root -g root -m 644 $$libfile $(SHAREDIR)/$(NAME)/$$libfile; \
done
2012-07-28 14:34:35 +00:00
## DATA SECTION
clean-data:
build-data:
install-data:
2011-07-31 01:15:23 +00:00
## Install man pages
mkdir -p $(MANDIR)/man1
for binfile in bin/*.rb ; do \
BINFILE=`basename $$binfile |sed -e 's/.rb$$//'`; \
cat man/$${BINFILE}.1 | gzip > $(MANDIR)/man1/$${BINFILE}.1.gz ; \
done
2011-07-31 01:15:23 +00:00
#
## Install icons
mkdir -p $(SHAREDIR)/$(NAME)/icons
install -D -o root -g root -m 644 $(CURDIR)/data/icons/$(NAME).svg \
$(SHAREDIR)/$(NAME)/icons/$(NAME).svg
2011-07-31 01:15:23 +00:00
#
2011-07-29 11:45:58 +00:00
## Install completion file
# install -D -o root -g root -m 644 $(CURDIR)/$(NAME).completion $(DESTDIR)/etc/bash_completion.d/$(NAME)
#
2011-07-31 01:15:23 +00:00
## Install configuration files
mkdir -p $(CONFDIR)/xdg/autostart
install -D -o root -g root -m 644 $(CURDIR)/conf/$(NAME).desktop \
$(CONFDIR)/xdg/autostart/$(NAME).desktop
install -D -o root -g root -m 644 $(CURDIR)/conf/$(NAME).desktop \
$(SHAREDIR)/applications/$(NAME).desktop
mkdir -p $(CONFDIR)/$(NAME)
install -D -o root -g root -m 644 $(CURDIR)/conf/config \
$(CONFDIR)/$(NAME)/config
install -D -o root -g root -m 644 $(CURDIR)/conf/default.map \
$(CONFDIR)/$(NAME)/default.map
2011-07-31 01:15:23 +00:00
#
# Install examples
mkdir -p $(DOCDIR)/$(NAME)/examples
for f in `ls examples`; do \
cat examples/$$f | gzip -f9 > $(DOCDIR)/$(NAME)/examples/$$f.gz ; \
done
2011-07-29 11:45:58 +00:00
2012-07-28 14:34:35 +00:00
## OTHER
2014-04-03 22:36:18 +00:00
.PHONY: destdir
2013-06-21 12:25:03 +00:00
dev-install:
2014-04-03 22:36:18 +00:00
rm -fr $(DEV_DESTDIR)
fakeroot $(MAKE) install DESTDIR=$(DEV_DESTDIR)
2011-07-29 11:45:58 +00:00