From 93bd73a3fc1d65769ecdb172165c68231d541328 Mon Sep 17 00:00:00 2001 From: guinux Date: Mon, 17 Nov 2014 21:56:15 +0100 Subject: [PATCH] improve makefiles --- .gitignore | 5 +- Makefile | 40 ++++++++++++ ...mac.policy => org.manjaro.pamac.policy.in} | 0 po/Makefile | 12 ++++ resources/Makefile | 45 +++++++++++++ src/Makefile | 65 +++---------------- 6 files changed, 109 insertions(+), 58 deletions(-) create mode 100644 Makefile rename data/polkit/{org.manjaro.pamac.policy => org.manjaro.pamac.policy.in} (100%) create mode 100644 po/Makefile create mode 100644 resources/Makefile diff --git a/.gitignore b/.gitignore index 0bf38d4..9df23db 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ -src/*.c +resources/*.c src/pamac-daemon src/pamac-tray src/pamac-manager src/pamac-install src/pamac-updater +data/polkit//org.manjaro.pamac.policy +po/*.mo +po/locale diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c6aeb18 --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ + +all: + cd resources; make resources + cd src; make binaries + cd po; make gettext + +clean: + rm -f src/*.c src/pamac-daemon src/pamac-tray src/pamac-updater src/pamac-manager src/pamac-install + rm -r resources/*.c + rm -rf po/locale + rm -f data/polkit/org.manjaro.pamac.policy + +install: + install -Dm744 src/pamac-daemon /usr/bin/pamac-daemon + install -Dm755 src/pamac-tray /usr/bin/pamac-tray + install -Dm755 src/pamac-manager /usr/bin/pamac-manager + install -Dm755 src/pamac-updater /usr/bin/pamac-updater + install -Dm755 src/pamac-install /usr/bin/pamac-install + #install -Dm755 src/pamac-refresh /usr/bin/pamac-refresh + install -Dm755 src/pamac-install /usr/bin/pamac-install + install -Dm644 data/applications/pamac-tray.desktop /etc/xdg/autostart/pamac-tray.desktop + install -Dm644 data/applications/pamac-manager.desktop /usr/share/applications/pamac-manager.desktop + install -Dm644 data/applications/pamac-updater.desktop /usr/share/applications/pamac-updater.desktop + install -Dm644 data/applications/pamac-install.desktop /usr/share/applications/pamac-install.desktop + install -Dm644 data/config/pamac.conf /etc/pamac.conf + install -Dm644 data/dbus/org.manjaro.pamac.conf /etc/dbus-1/system.d/org.manjaro.pamac.conf + install -Dm644 data/dbus/org.manjaro.pamac.service /usr/share/dbus-1/system-services/org.manjaro.pamac.service + install -Dm644 data/systemd/pamac.service /usr/lib/systemd/system/pamac.service + #install -Dm744 data/networkmanager/99_update_pamac_tray /etc/NetworkManager/dispatcher.d/99_update_pamac_tray + install -Dm644 data/polkit/org.manjaro.pamac.policy /usr/share/polkit-1/actions/org.manjaro.pamac.policy + +uninstall: + rm -f /usr/bin/pamac-daemon /usr/bin/pamac-updater /usr/bin/pamac-tray /usr/bin/pamac-manager /usr/bin/pamac-install + rm -f /etc/xdg/autostart/pamac-tray.desktop + rm -f /usr/share/applications/pamac-manager.desktop /usr/share/applications/pamac-updater.desktop /usr/share/applications/pamac-install.desktop + rm -f /etc/pamac.conf + rm -f /etc/dbus-1/system.d/org.manjaro.pamac.conf + rm -f /usr/share/dbus-1/system-services/org.manjaro.pamac.service + rm -f /usr/lib/systemd/system/pamac.service + rm -f /usr/share/polkit-1/actions/org.manjaro.pamac.policy diff --git a/data/polkit/org.manjaro.pamac.policy b/data/polkit/org.manjaro.pamac.policy.in similarity index 100% rename from data/polkit/org.manjaro.pamac.policy rename to data/polkit/org.manjaro.pamac.policy.in diff --git a/po/Makefile b/po/Makefile new file mode 100644 index 0000000..78ed226 --- /dev/null +++ b/po/Makefile @@ -0,0 +1,12 @@ + +MSGLANGS=$(notdir $(wildcard *.po)) + +MSGOBJS=$(addprefix locale/,$(MSGLANGS:.po=/LC_MESSAGES/pamac.mo)) + +locale/%/LC_MESSAGES/pamac.mo: %.po + msgfmt -c -o $*.mo $*.po + mkdir -p $(dir $@) + cp $*.mo $(dir $@)pamac.mo + +gettext: $(MSGOBJS) + itstool -j ../data/polkit/org.manjaro.pamac.policy.in -o ../data/polkit/org.manjaro.pamac.policy $(MSGLANGS:.po=.mo) diff --git a/resources/Makefile b/resources/Makefile new file mode 100644 index 0000000..9a31b60 --- /dev/null +++ b/resources/Makefile @@ -0,0 +1,45 @@ + +MANAGER_GRESOURCE_FILE = pamac.manager.gresource.xml + +MANAGER_RESOURCES_FILES = manager_window.ui \ + packages_chooser_dialog.ui \ + choose_dep_dialog.ui \ + history_dialog.ui \ + preferences_dialog.ui \ + progress_dialog.ui \ + choose_provider_dialog.ui \ + transaction_sum_dialog.ui \ + transaction_info_dialog.ui \ + package-available.png \ + package-install.png \ + package-installed-locked.png \ + package-installed-updated.png \ + package-reinstall.png \ + package-remove.png + +UPDATER_GRESOURCE_FILE = pamac.updater.gresource.xml + +UPDATER_RESOURCES_FILES = updater_window.ui \ + preferences_dialog.ui \ + progress_dialog.ui \ + choose_provider_dialog.ui \ + transaction_sum_dialog.ui \ + transaction_info_dialog.ui + +INSTALLER_GRESOURCE_FILE = pamac.installer.gresource.xml + +INSTALLER_RESOURCES_FILES = progress_dialog.ui \ + choose_provider_dialog.ui \ + transaction_sum_dialog.ui \ + transaction_info_dialog.ui + +manager_resources.c: $(MANAGER_GRESOURCE_FILE) $(MANAGER_RESOURCES_FILES) + glib-compile-resources $(MANAGER_GRESOURCE_FILE) --target=manager_resources.c --generate-source + +updater_resources.c: $(UPDATER_GRESOURCE_FILE) $(UPDATER_RESOURCES_FILES) + glib-compile-resources $(UPDATER_GRESOURCE_FILE) --target=updater_resources.c --generate-source + +installer_resources.c: $(INSTALLER_GRESOURCE_FILE) $(INSTALLER_RESOURCES_FILES) + glib-compile-resources $(INSTALLER_GRESOURCE_FILE) --target=installer_resources.c --generate-source + +resources: manager_resources.c updater_resources.c installer_resources.c diff --git a/src/Makefile b/src/Makefile index ba208cf..119aa22 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,3 +1,4 @@ + COMMON_VALA_FLAGS = --pkg=libalpm \ --pkg=gio-2.0 \ --pkg=posix \ @@ -17,38 +18,10 @@ COMMON_SOURCES = ../util/alpm-util.c \ MANAGER_GRESOURCE_FILE = ../resources/pamac.manager.gresource.xml -MANAGER_RESOURCES_FILES = ../resources/manager_window.ui \ - ../resources/packages_chooser_dialog.ui \ - ../resources/choose_dep_dialog.ui \ - ../resources/history_dialog.ui \ - ../resources/preferences_dialog.ui \ - ../resources/progress_dialog.ui \ - ../resources/choose_provider_dialog.ui \ - ../resources/transaction_sum_dialog.ui \ - ../resources/transaction_info_dialog.ui \ - ../resources/package-available.png \ - ../resources/package-install.png \ - ../resources/package-installed-locked.png \ - ../resources/package-installed-updated.png \ - ../resources/package-reinstall.png \ - ../resources/package-remove.png - UPDATER_GRESOURCE_FILE = ../resources/pamac.updater.gresource.xml -UPDATER_RESOURCES_FILES = ../resources/updater_window.ui \ - ../resources/preferences_dialog.ui \ - ../resources/progress_dialog.ui \ - ../resources/choose_provider_dialog.ui \ - ../resources/transaction_sum_dialog.ui \ - ../resources/transaction_info_dialog.ui - INSTALLER_GRESOURCE_FILE = ../resources/pamac.installer.gresource.xml -INSTALLER_RESOURCES_FILES = ../resources/progress_dialog.ui \ - ../resources/choose_provider_dialog.ui \ - ../resources/transaction_sum_dialog.ui \ - ../resources/transaction_info_dialog.ui - DIALOGS_FILES = choose_provider_dialog.vala \ transaction_sum_dialog.vala \ transaction_info_dialog.vala \ @@ -70,16 +43,7 @@ pamac-tray: ../vapi/libalpm.vapi $(COMMON_SOURCES) tray.vala $(COMMON_SOURCES) \ tray.vala -manager_resources.c: $(MANAGER_GRESOURCE_FILE) $(MANAGER_RESOURCES_FILES) - glib-compile-resources $(MANAGER_GRESOURCE_FILE) --sourcedir=../resources --target=manager_resources.c --generate-source - -updater_resources.c: $(UPDATER_GRESOURCE_FILE) $(UPDATER_RESOURCES_FILES) - glib-compile-resources $(UPDATER_GRESOURCE_FILE) --sourcedir=../resources --target=updater_resources.c --generate-source - -installer_resources.c: $(INSTALLER_GRESOURCE_FILE) $(INSTALLER_RESOURCES_FILES) - glib-compile-resources $(INSTALLER_GRESOURCE_FILE) --sourcedir=../resources --target=installer_resources.c --generate-source - -pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) choose_dep_dialog.vala preferences_dialog.vala history_dialog.vala packages_chooser_dialog.vala manager_resources.c package.vala transaction.vala packages_model.vala manager_window.vala manager.vala +pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) choose_dep_dialog.vala preferences_dialog.vala history_dialog.vala packages_chooser_dialog.vala ../resources/manager_resources.c package.vala transaction.vala packages_model.vala manager_window.vala manager.vala valac -o pamac-manager \ $(COMMON_VALA_FLAGS) \ --pkg=gtk+-3.0 \ @@ -93,14 +57,14 @@ pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) choose_de preferences_dialog.vala \ history_dialog.vala \ packages_chooser_dialog.vala \ - manager_resources.c \ + ../resources/manager_resources.c \ package.vala \ transaction.vala \ packages_model.vala \ manager_window.vala \ manager.vala -pamac-updater: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala updater_resources.c transaction.vala updater_window.vala updater.vala +pamac-updater: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala ../resources/updater_resources.c transaction.vala updater_window.vala updater.vala valac -o pamac-updater \ $(COMMON_VALA_FLAGS) \ --pkg=gtk+-3.0 \ @@ -110,12 +74,12 @@ pamac-updater: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) preferenc $(COMMON_SOURCES) \ $(DIALOGS_FILES) \ preferences_dialog.vala \ - updater_resources.c \ + ../resources/updater_resources.c \ transaction.vala \ updater_window.vala \ updater.vala -pamac-install: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) installer_resources.c transaction.vala installer.vala +pamac-install: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) ../resources/installer_resources.c transaction.vala installer.vala valac -o pamac-install \ $(COMMON_VALA_FLAGS) \ --pkg=gtk+-3.0 \ @@ -124,21 +88,8 @@ pamac-install: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) installer --gresources=$(INSTALLER_GRESOURCE_FILE) \ $(COMMON_SOURCES) \ $(DIALOGS_FILES) \ - installer_resources.c \ + ../resources/installer_resources.c \ transaction.vala \ installer.vala -all: pamac-daemon pamac-tray pamac-updater pamac-manager pamac-install - -clean: - rm -f *.c pamac-daemon pamac-tray pamac-updater pamac-manager pamac-install - -install: - install -Dm744 pamac-daemon /usr/bin/pamac-daemon - install -Dm755 pamac-tray /usr/bin/pamac-tray - install -Dm755 pamac-manager /usr/bin/pamac-manager - install -Dm755 pamac-updater /usr/bin/pamac-updater - install -Dm755 pamac-install /usr/bin/pamac-install - -uninstall: - rm -f /usr/bin/pamac-daemon /usr/bin/pamac-updater /usr/bin/pamac-tray /usr/bin/pamac-manager /usr/bin/pamac-install +binaries: pamac-daemon pamac-tray pamac-updater pamac-manager pamac-install