Skip to content

Changed Makefile to build only changed files #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 39 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,50 @@
emotes_target = "/usr/share/pixmaps/pidgin/emotes"
emotes_src = "emotes/src"
emotes_theme = "emotes/elementary"
status_dir = "~/.purple/themes/elementary"
status_theme = "status-icons/purple"

convert:
for icon in $(emotes_src)/*.svg; do \
inkscape -z $$icon -e $${icon%%.*}.png; \
done
mv $(emotes_src)/*.png $(emotes_theme)
emotes_target = /usr/share/pixmaps/pidgin/emotes
emotes_src = emotes/src
emotes_theme = emotes/elementary
status_dir = ~/.purple/themes/elementary
status_theme = status-icons/purple
status_theme_src = status-icons/src
status_theme_dst = status-icons/purple/status-icon

convert: convert-emotes convert-status

all_emote_svgs = $(wildcard $(emotes_src)/*.svg)
all_emote_pngs = $(subst $(emotes_src),$(emotes_theme),$(all_emote_svgs:%.svg=%.png))

convert-emotes: $(all_emote_pngs)

#special "out of tree" build
$(emotes_theme)/%.png: $(emotes_src)/%.svg
inkscape -z $< -e $@

all_status_svgs = $(shell find $(status_theme_src) -type f -name '*.svg')
all_status_pngs = $(subst $(status_theme_src),$(status_theme_dst),$(all_status_svgs:%.svg=%.png))

convert-status: $(all_status_pngs)

#special "out of tree" build
$(status_theme_dst)/%.png: $(status_theme_src)/%.svg
inkscape -z $< -e $@

check-root:
@[ $$(id -u) -eq 0 ] || (echo "-- You need to be root for this to work\n" ; exit 1)

install: install-emotes install-status

install-emotes:
install-emotes: check-root convert-emotes
cp -r $(emotes_theme) $(emotes_target)

install-status:
mkdir -p $(status_dir)
cp -r $(status_theme) $(status_dir)
install-status: check-root convert-status
sudo --user $$(SUDO_USER) mkdir -p $(status_dir)
sudo --user $$(SUDO_USER) cp -r $(status_theme) $(status_dir)

uninstall: uninstall-emotes uninstall-status

uninstall-emotes:
uninstall-emotes: check-root
test -e $(emotes_target)/elementary && rm -rfv $(emotes_target)/elementary

uninstall-status:
uninstall-status: check-root
test -e $(status_dir) && rm -rfv $(status_dir)

clean:
rm -f $(all_emote_pngs) $(all_status_pngs)