~s.jansen/+junk/gogglesmm

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
155
156
157
158
159
#-----------------------------------------------------------
# GOGGLES BUILD SYSTEM
#-----------------------------------------------------------
#
# The actual make file
#
#-----------------------------------------------------------

.PHONY : all plugins clean realclean cleanicons install install-desktop nls

ifeq "$(wildcard config.make)" ""
  $(error No configuration found. Run ./configure first)
endif

include config.make

# Set suffixes
.SUFFIXES:
.SUFFIXES: .cpp .h .gif .png $(OBJEXT) $(BINEXT) $(LIBEXT)

# Set Installation directories
installdir=$(DESTDIR)$(PREFIX)
bindir=$(installdir)/bin
libdir=$(DESTDIR)$(LIBDIR)
sharedir=$(installdir)/share
localefile=$(sharedir)/locale/$(tr)/LC_MESSAGES/gogglesmm.mo
pluginfile=$(libdir)/gogglesmm/$(notdir $(plugin))
mandir=$(sharedir)/man
icondir=$(sharedir)/icons


# Install Utility
INSTALL=install

# Define Targets
include build/targets.mk

# Build Targets
all: $(GAP_ALL_PLUGINS) $(GMM_NAME) 

# Get Sources and Rules
include build/gap.mk
include build/gmm.mk

# Setup Translations
TRANSLATIONS:=$(basename $(notdir $(wildcard po/*.mo)))
LINGUAS?=$(TRANSLATIONS)

# How to update the icon cache
UPDATE_ICON_CACHE:=$(shell command -v xdg-icon-resource 2> /dev/null)

# Install Variables

# Install
#----------------------------------------------------------
install: $(GMM_NAME) $(GAP_ALL_PLUGINS)

	@echo "    Installing $(bindir)/gogglesmm ..."
	@$(INSTALL) -D -m 755 src/gogglesmm $(bindir)/gogglesmm
	@$(foreach plugin,$(GAP_ALL_PLUGINS),echo "    Installing $(pluginfile) ..." ; $(INSTALL) -D -m 755  $(plugin) $(pluginfile);)

	@echo "    Installing $(sharedir)/applications/gogglesmm.desktop"
	@$(INSTALL) -D -m 644 extra/gogglesmm.desktop $(sharedir)/applications/gogglesmm.desktop
	@$(INSTALL) -D -m 644 extra/gogglesmm.appdata.xml $(sharedir)/appdata/gogglesmm.appdata.xml

	@echo "    Installing $(sharedir)/gogglesmm/utils"
	@$(INSTALL) -D -m 644 extra/import_banshee_stats.py $(sharedir)/gogglesmm/utils/import_banshee_stats.py
	@$(INSTALL) -D -m 644 extra/import_gogglesmm12.py $(sharedir)/gogglesmm/utils/import_gogglesmm12.py
	@$(INSTALL) -D -m 644 extra/import_gogglesmm12_stats.py $(sharedir)/gogglesmm/utils/import_gogglesmm12_stats.py

	@echo "    Installing $(mandir)/man1/gogglesmm.1"
	@$(INSTALL) -m 644 -D extra/gogglesmm.1 $(mandir)/man1/gogglesmm.1

# install nls if needed
ifneq (,$(findstring nls,$(OPTIONS)))
	@$(foreach tr,$(filter $(TRANSLATIONS),$(LINGUAS)),echo "    Installing $(localefile) ..." ;$(INSTALL) -m 644 -D po/$(tr).mo $(localefile); )
endif

	@echo "    Installing icons..."
	@$(INSTALL) -m 644 -D icons/gogglesmm_16.png $(icondir)/hicolor/16x16/apps/gogglesmm.png
	@$(INSTALL) -m 644 -D extra/gogglesmm_22.png $(icondir)/hicolor/22x22/apps/gogglesmm.png
	@$(INSTALL) -m 644 -D extra/gogglesmm_24.png $(icondir)/hicolor/24x24/apps/gogglesmm.png
	@$(INSTALL) -m 644 -D icons/gogglesmm_32.png $(icondir)/hicolor/32x32/apps/gogglesmm.png
	@$(INSTALL) -m 644 -D extra/gogglesmm_48.png $(icondir)/hicolor/48x48/apps/gogglesmm.png
	@$(INSTALL) -m 644 -D extra/gogglesmm.svg $(icondir)/hicolor/scalable/apps/gogglesmm.svg

# Update the icon cache if we can, but only if destdir is not defined.
ifndef DESTDIR
ifdef UPDATE_ICON_CACHE
	@echo "    Updating Icon Cache"
	@xdg-icon-resource forceupdate --theme hicolor
else
	@echo "    Cannot Update Icon Cache: xdg-icon-resource not found"
endif
endif
	@echo "    Done."


svg2png:
	rsvg-convert -w 22  extra/gogglesmm.svg -o extra/gogglesmm_22.png
	rsvg-convert -w 24  extra/gogglesmm.svg -o extra/gogglesmm_24.png
	rsvg-convert -w 48  extra/gogglesmm.svg -o extra/gogglesmm_48.png


# Clean
#----------------------------------------------------------
clean :
	@echo "    Remove Executables ..."
	@rm -f $(GMM_NAME) $(GAP_ALL_PLUGINS)
	@echo "    Remove Objects ..."
	@rm -f src/*$(OBJEXT)
	@rm -f src/*.d
	@rm -f src/gap/*$(OBJEXT)
	@rm -f src/gap/*.d
	@rm -f src/gap/plugins/*$(OBJEXT)
	@rm -f src/gap/plugins/*.d
	@echo "    Remove Generated Files ..."
	@rm -f src/icons.cpp
	@rm -f src/icons.h
	@rm -f src/gogglesmm_xml.h
	@rm -f src/mpris1_xml.h
	@rm -f src/mpris2_xml.h
	@rm -f src/appstatus_xml.h

#----------------------------------------------------------

realclean : clean
	@echo "    Remove Configuration ..."
	@rm -f config.make
	@rm -f src/gmconfig.h
	@rm -f src/gap/ap_config.h
	@rm -f po/*.mo
  
PO_FILES=$(wildcard po/*.po)
MO_FILES=$(PO_FILES:.po=.mo)

# Make mo files
%.mo: %.po
	msgfmt $< -o $@ 

nls: $(MO_FILES)

dist: svg2png clean realclean nls
	@echo " Creating Tarbals .."
	tar --create --xz --file='../../$(TARNAME).tar.xz' --verbose --exclude-vcs --exclude='*.tar.xz' --transform='s/^./$(TARNAME)/' --show-transformed-names .

# Clean Icons
cleanicons : $(MO_FILES)
	@rm -f src/icons.*
	@rm -f include/icons.*

# Compile to object
%$(OBJEXT):	%.cpp
	@echo "    Compiling $< ..."
	@$(CXX) $(CFLAGS) $(DEFS) $(CPPFLAGS) -MM -o $*.d -MT $@ $<
	@$(CXX) $(CFLAGS) $(DEFS) $(CPPFLAGS) $(OUTPUTOBJ)$@ -c $<

# How to make everything else
-include $(DEPENDENCIES)