Modularize the Makefiles.

* It's a good practice to put the main target on top, since it's the
  first one that is called when calling just "make". That's why
  "resources", "binaries" and "gettext" were moved up in their
  Makefile's.
* Added a "clean" target for each subdirectories so that they are a bit
  more autonomous.
* Using "&&" instead of ";" when changing directory because if a
  directory name is changed, we get into an infinite loop.
This commit is contained in:
Romain Failliot 2015-01-24 12:09:47 -05:00
parent c6b29785f5
commit dc6cc1e5f9
4 changed files with 23 additions and 14 deletions

View File

@ -1,14 +1,13 @@
all: all:
cd resources; make resources cd resources && make resources
cd src; make binaries cd src && make binaries
cd po; make gettext cd po && make gettext
clean: clean:
rm -f src/*.c src/pamac-refresh src/pamac-daemon src/pamac-tray src/pamac-updater src/pamac-manager src/pamac-install cd resources && make clean
rm -f resources/*.c cd src && make clean
rm -rf po/locale cd po && make clean
rm -f po/*.mo
rm -f data/polkit/org.manjaro.pamac.policy rm -f data/polkit/org.manjaro.pamac.policy
install: install:

View File

@ -3,10 +3,14 @@ MSGLANGS=$(notdir $(wildcard *.po))
MSGOBJS=$(addprefix locale/,$(MSGLANGS:.po=/LC_MESSAGES/pamac.mo)) MSGOBJS=$(addprefix locale/,$(MSGLANGS:.po=/LC_MESSAGES/pamac.mo))
gettext: $(MSGOBJS)
itstool -j ../data/polkit/org.manjaro.pamac.policy.in -o ../data/polkit/org.manjaro.pamac.policy $(MSGLANGS:.po=.mo)
clean:
rm -rf locale
rm -f *.mo
locale/%/LC_MESSAGES/pamac.mo: %.po locale/%/LC_MESSAGES/pamac.mo: %.po
msgfmt -c -o $*.mo $*.po msgfmt -c -o $*.mo $*.po
mkdir -p $(dir $@) mkdir -p $(dir $@)
cp $*.mo $(dir $@)pamac.mo 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)

View File

@ -33,6 +33,11 @@ INSTALLER_RESOURCES_FILES = progress_dialog.ui \
transaction_sum_dialog.ui \ transaction_sum_dialog.ui \
transaction_info_dialog.ui transaction_info_dialog.ui
resources: manager_resources.c updater_resources.c installer_resources.c
clean:
rm -f *.c
manager_resources.c: $(MANAGER_GRESOURCE_FILE) $(MANAGER_RESOURCES_FILES) manager_resources.c: $(MANAGER_GRESOURCE_FILE) $(MANAGER_RESOURCES_FILES)
glib-compile-resources $(MANAGER_GRESOURCE_FILE) --target=manager_resources.c --generate-source glib-compile-resources $(MANAGER_GRESOURCE_FILE) --target=manager_resources.c --generate-source
@ -41,5 +46,3 @@ updater_resources.c: $(UPDATER_GRESOURCE_FILE) $(UPDATER_RESOURCES_FILES)
installer_resources.c: $(INSTALLER_GRESOURCE_FILE) $(INSTALLER_RESOURCES_FILES) installer_resources.c: $(INSTALLER_GRESOURCE_FILE) $(INSTALLER_RESOURCES_FILES)
glib-compile-resources $(INSTALLER_GRESOURCE_FILE) --target=installer_resources.c --generate-source glib-compile-resources $(INSTALLER_GRESOURCE_FILE) --target=installer_resources.c --generate-source
resources: manager_resources.c updater_resources.c installer_resources.c

View File

@ -29,6 +29,11 @@ DIALOGS_FILES = choose_provider_dialog.vala \
preferences_dialog.vala \ preferences_dialog.vala \
progress_dialog.vala progress_dialog.vala
binaries: pamac-refresh pamac-daemon pamac-tray pamac-updater pamac-manager pamac-install
clean:
rm -f *.c pamac-refresh pamac-daemon pamac-tray pamac-updater pamac-manager pamac-install
pamac-refresh: refresh.vala pamac-refresh: refresh.vala
valac -o pamac-refresh \ valac -o pamac-refresh \
--pkg=gio-2.0 \ --pkg=gio-2.0 \
@ -100,5 +105,3 @@ pamac-install: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) ../resour
mirrors_config.vala \ mirrors_config.vala \
transaction.vala \ transaction.vala \
installer.vala installer.vala
binaries: pamac-refresh pamac-daemon pamac-tray pamac-updater pamac-manager pamac-install