| 1 | # If you need to debug some classpath, includes, or command line arguments |
|---|
| 2 | # option, then comment out MAKEFLAGS line below, or set V=1 on the command |
|---|
| 3 | # line before make. |
|---|
| 4 | # |
|---|
| 5 | ifdef V |
|---|
| 6 | else |
|---|
| 7 | MAKEFLAGS=-s |
|---|
| 8 | endif |
|---|
| 9 | |
|---|
| 10 | .PHONY: all dirs compile translation install clean distclean |
|---|
| 11 | |
|---|
| 12 | -include .config |
|---|
| 13 | |
|---|
| 14 | all: .config dirs compile translation gnome-split |
|---|
| 15 | |
|---|
| 16 | .config: src/org/gnome/split/config/Constants.java |
|---|
| 17 | /bin/echo |
|---|
| 18 | /bin/echo "You need to run ./configure to check prerequisites" |
|---|
| 19 | /bin/echo "and setup preferences before you can build GNOME Split." |
|---|
| 20 | ( if [ ! -x configure ] ; then chmod +x configure ; /bin/echo "I just made it executable for you." ; fi ) |
|---|
| 21 | /bin/echo |
|---|
| 22 | exit 1 |
|---|
| 23 | |
|---|
| 24 | CLASSPATH=$(JAVA_GNOME_JAR):$(DBUS_JAVA_JAR):$(DEBUG_DISABLE_JAR):$(DEBUG_ENABLE_JAR):$(HEXDUMP_JAR):$(UNIX_SOCKET) |
|---|
| 25 | |
|---|
| 26 | SOURCES_DIST=$(shell find src/ -name '*.java') |
|---|
| 27 | TRANSLATIONS=$(shell find po/ -name '*.po' | sed -e 's/po\/\(.*\)\.po/share\/locale\/\1\/LC_MESSAGES\/gnome-split\.mo/g') |
|---|
| 28 | |
|---|
| 29 | dirs: tmp/classes tmp/stamp tmp/i18n |
|---|
| 30 | |
|---|
| 31 | tmp/classes: |
|---|
| 32 | @/bin/echo -e "MKDIR\t$@" |
|---|
| 33 | mkdir $@ |
|---|
| 34 | |
|---|
| 35 | tmp/stamp: |
|---|
| 36 | @/bin/echo -e "MKDIR\t$@" |
|---|
| 37 | mkdir $@ |
|---|
| 38 | |
|---|
| 39 | tmp/i18n: |
|---|
| 40 | @/bin/echo -e "MKDIR\t$@" |
|---|
| 41 | mkdir $@ |
|---|
| 42 | |
|---|
| 43 | # -------------------------------------------------------------------- |
|---|
| 44 | # Source compilation |
|---|
| 45 | # -------------------------------------------------------------------- |
|---|
| 46 | |
|---|
| 47 | # Build the sources (that are part of the distributed app) |
|---|
| 48 | compile: tmp/stamp/compile |
|---|
| 49 | tmp/stamp/compile: $(SOURCES_DIST) |
|---|
| 50 | @/bin/echo -e "$(JAVAC_CMD)\ttmp/classes/*.class" |
|---|
| 51 | $(JAVAC) -d tmp/classes -classpath tmp/classes:$(CLASSPATH) -sourcepath src/ $^ |
|---|
| 52 | touch $@ |
|---|
| 53 | |
|---|
| 54 | translation: tmp/i18n/gnome-split.pot $(TRANSLATIONS) |
|---|
| 55 | |
|---|
| 56 | # Strictly speaking, not necessary to generate the .pot file, but this has to |
|---|
| 57 | # go somewhere and might as well get it done |
|---|
| 58 | tmp/i18n/gnome-split.pot: $(SOURCES_DIST) |
|---|
| 59 | @/bin/echo -e "EXTRACT\t$@" |
|---|
| 60 | xgettext -o $@ --omit-header --keyword=_ --keyword=N_ $^ |
|---|
| 61 | |
|---|
| 62 | share/locale/%/LC_MESSAGES/gnome-split.mo: po/%.po |
|---|
| 63 | mkdir -p $(dir $@) |
|---|
| 64 | @/bin/echo -e "MSGFMT\t$@" |
|---|
| 65 | msgfmt -o $@ $< |
|---|
| 66 | |
|---|
| 67 | gnome-split: tmp/launcher/gnome-split-local |
|---|
| 68 | @/bin/echo -e "CP\t$@" |
|---|
| 69 | cp -f $< $@ |
|---|
| 70 | chmod +x $@ |
|---|
| 71 | |
|---|
| 72 | # -------------------------------------------------------------------- |
|---|
| 73 | # Installation |
|---|
| 74 | # -------------------------------------------------------------------- |
|---|
| 75 | |
|---|
| 76 | install: all \ |
|---|
| 77 | $(DESTDIR)$(JARDIR)/gnome-split-$(VERSION).jar \ |
|---|
| 78 | tmp/stamp/install-pixmaps \ |
|---|
| 79 | tmp/stamp/install-translations \ |
|---|
| 80 | $(DESTDIR)$(PREFIX)/share/applications/gnome-split.desktop \ |
|---|
| 81 | $(DESTDIR)$(PREFIX)/share/mime/packages/gnome-split.xml \ |
|---|
| 82 | $(DESTDIR)$(PREFIX)/bin/gnome-split |
|---|
| 83 | |
|---|
| 84 | $(DESTDIR)$(PREFIX): |
|---|
| 85 | @/bin/echo -e "MKDIR\t$(DESTDIR)$(PREFIX)/" |
|---|
| 86 | -mkdir -p $(DESTDIR)$(PREFIX) |
|---|
| 87 | |
|---|
| 88 | $(DESTDIR)$(PREFIX)/bin: |
|---|
| 89 | @/bin/echo -e "MKDIR\t$@/" |
|---|
| 90 | -mkdir -p $@ |
|---|
| 91 | |
|---|
| 92 | $(DESTDIR)$(JARDIR): |
|---|
| 93 | @/bin/echo -e "MKDIR\t$@/" |
|---|
| 94 | -mkdir -p $@ |
|---|
| 95 | |
|---|
| 96 | $(DESTDIR)$(PREFIX)/share/applications: |
|---|
| 97 | @/bin/echo -e "MKDIR\t$@/" |
|---|
| 98 | -mkdir -p $@ |
|---|
| 99 | |
|---|
| 100 | $(DESTDIR)$(PREFIX)/share/mime/packages: |
|---|
| 101 | @/bin/echo -e "MKDIR\t$@/" |
|---|
| 102 | -mkdir -p $@ |
|---|
| 103 | |
|---|
| 104 | $(DESTDIR)$(PREFIX)/bin/gnome-split: \ |
|---|
| 105 | $(DESTDIR)$(PREFIX)/bin \ |
|---|
| 106 | tmp/launcher/gnome-split-install |
|---|
| 107 | @/bin/echo -e "INSTALL\t$@" |
|---|
| 108 | cp -f tmp/launcher/gnome-split-install $@ |
|---|
| 109 | chmod +x $@ |
|---|
| 110 | |
|---|
| 111 | $(DESTDIR)$(PREFIX)/share/applications/gnome-split.desktop: \ |
|---|
| 112 | $(DESTDIR)$(PREFIX)/share/applications \ |
|---|
| 113 | tmp/launcher/gnome-split.desktop |
|---|
| 114 | @/bin/echo -e "INSTALL\t$@" |
|---|
| 115 | cp -f tmp/launcher/gnome-split.desktop $@ |
|---|
| 116 | |
|---|
| 117 | $(DESTDIR)$(PREFIX)/share/mime/packages/gnome-split.xml: \ |
|---|
| 118 | $(DESTDIR)$(PREFIX)/share/mime/packages \ |
|---|
| 119 | tmp/launcher/gnome-split.xml |
|---|
| 120 | @/bin/echo -e "INSTALL\t$@" |
|---|
| 121 | cp -f tmp/launcher/gnome-split.xml $@ |
|---|
| 122 | |
|---|
| 123 | tmp/gnome-split.jar: tmp/stamp/compile |
|---|
| 124 | @/bin/echo -e "$(JAR_CMD)\t$@" |
|---|
| 125 | $(JAR) -cf tmp/gnome-split.jar -C tmp/classes . |
|---|
| 126 | |
|---|
| 127 | $(DESTDIR)$(PREFIX)/share/pixmaps: |
|---|
| 128 | @/bin/echo -e "MKDIR\t$@/" |
|---|
| 129 | -mkdir $@ |
|---|
| 130 | |
|---|
| 131 | $(DESTDIR)$(PREFIX)/share/locale: |
|---|
| 132 | @/bin/echo -e "MKDIR\t$@/" |
|---|
| 133 | -mkdir $@ |
|---|
| 134 | |
|---|
| 135 | tmp/stamp/install-pixmaps: \ |
|---|
| 136 | $(DESTDIR)$(PREFIX)/share/pixmaps \ |
|---|
| 137 | share/pixmaps/*.png |
|---|
| 138 | @/bin/echo -e "INSTALL\t$(DESTDIR)$(PREFIX)/share/pixmaps/*.png" |
|---|
| 139 | cp -f share/pixmaps/*.png $(DESTDIR)$(PREFIX)/share/pixmaps |
|---|
| 140 | touch $@ |
|---|
| 141 | |
|---|
| 142 | tmp/stamp/install-translations: \ |
|---|
| 143 | $(DESTDIR)$(PREFIX)/share/locale \ |
|---|
| 144 | share/locale/*/LC_MESSAGES/gnome-split.mo |
|---|
| 145 | @/bin/echo -e "INSTALL\t$(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/gnome-split.mo" |
|---|
| 146 | cp -af share/locale/* $(DESTDIR)$(PREFIX)/share/locale |
|---|
| 147 | touch $@ |
|---|
| 148 | |
|---|
| 149 | $(DESTDIR)$(JARDIR)/gnome-split-$(VERSION).jar: \ |
|---|
| 150 | $(DESTDIR)$(JARDIR) \ |
|---|
| 151 | tmp/gnome-split.jar |
|---|
| 152 | @/bin/echo -e "INSTALL\t$@" |
|---|
| 153 | cp -f tmp/gnome-split.jar $@ |
|---|
| 154 | @/bin/echo -e "SYMLINK\t$(@D)/gnome-split.jar -> gnome-split-$(VERSION).jar" |
|---|
| 155 | cd $(@D) && rm -f gnome-split.jar && ln -s gnome-split-$(VERSION).jar gnome-split.jar |
|---|
| 156 | |
|---|
| 157 | # -------------------------------------------------------------------- |
|---|
| 158 | # Uninstallation |
|---|
| 159 | # -------------------------------------------------------------------- |
|---|
| 160 | |
|---|
| 161 | uninstall: |
|---|
| 162 | @/bin/echo -e "RM\t$(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/gnome-split.mo" |
|---|
| 163 | rm -f $(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/gnome-split.mo |
|---|
| 164 | @/bin/echo -e "RM\t$(DESTDIR)$(PREFIX)/share/pixmaps/*.png" |
|---|
| 165 | rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/gnome-split.png |
|---|
| 166 | @/bin/echo -e "RM\t$(DESTDIR)$(PREFIX)/share/applications/gnome-split.desktop" |
|---|
| 167 | rm -f $(DESTDIR)$(PREFIX)/share/applications/gnome-split.desktop |
|---|
| 168 | @/bin/echo -e "RM\t$(DESTDIR)$(PREFIX)/share/mime/packages/gnome-split.xml" |
|---|
| 169 | rm -f $(DESTDIR)$(PREFIX)/share/mime/packages/gnome-split.xml |
|---|
| 170 | @/bin/echo -e "RM\t$(DESTDIR)$(PREFIX)/bin/gnome-split" |
|---|
| 171 | rm -f $(DESTDIR)$(PREFIX)/bin/gnome-split |
|---|
| 172 | @/bin/echo -e "RM\t$(DESTDIR)$(JARDIR)/gnome-split-$(VERSION).jar" |
|---|
| 173 | rm -f $(DESTDIR)$(JARDIR)/gnome-split-$(VERSION).jar |
|---|
| 174 | rm -f $(DESTDIR)$(JARDIR)/gnome-split.jar |
|---|
| 175 | |
|---|
| 176 | # -------------------------------------------------------------------- |
|---|
| 177 | # House keeping |
|---|
| 178 | # -------------------------------------------------------------------- |
|---|
| 179 | |
|---|
| 180 | # [note that we don't remove .config here, as a) darcs doesn't pick it up |
|---|
| 181 | # so if it's hanging around it won't cause problems, and b) if it is removed |
|---|
| 182 | # here, then `make clean all` fails] |
|---|
| 183 | clean: |
|---|
| 184 | @/bin/echo -e "RM\ttemporary build directories" |
|---|
| 185 | -rm -rf tmp/classes |
|---|
| 186 | -rm -rf tmp/stamp |
|---|
| 187 | -rm -rf hs_err_* |
|---|
| 188 | @/bin/echo -e "RM\texecutables and wrappers" |
|---|
| 189 | -rm -f tmp/gnome-split.jar |
|---|
| 190 | -rm -f gnome-split |
|---|
| 191 | @/bin/echo -e "RM\tgenerated message files" |
|---|
| 192 | -rm -rf share/locale |
|---|
| 193 | |
|---|
| 194 | distclean: clean |
|---|
| 195 | @/bin/echo -e "RM\tbuild configuration information" |
|---|
| 196 | -rm -f .config .config.tmp |
|---|
| 197 | -rm -rf tmp/ |
|---|
| 198 | |
|---|
| 199 | # -------------------------------------------------------------------- |
|---|
| 200 | # Distribution target |
|---|
| 201 | # -------------------------------------------------------------------- |
|---|
| 202 | |
|---|
| 203 | # |
|---|
| 204 | # Remember that if you bump the version number you need to commit the change |
|---|
| 205 | # and re-./configure before being able to run this! On the other hand, we |
|---|
| 206 | # don't have to distclean before calling this. |
|---|
| 207 | # |
|---|
| 208 | dist: all |
|---|
| 209 | @/bin/echo -e "CHECK\tfully committed state" |
|---|
| 210 | bzr diff > /dev/null || ( echo -e "\nYou need to commit all changes before running make dist\n" ; exit 4 ) |
|---|
| 211 | @/bin/echo -e "EXPORT\ttmp/gnome-split-$(VERSION)" |
|---|
| 212 | -rm -rf tmp/gnome-split-$(VERSION) |
|---|
| 213 | bzr export --format=dir tmp/gnome-split-$(VERSION) |
|---|
| 214 | @/bin/echo -e "TAR\tgnome-split-$(VERSION).tar.bz2" |
|---|
| 215 | tar cjf gnome-split-$(VERSION).tar.bz2 -C tmp gnome-split-$(VERSION) |
|---|
| 216 | rm -r tmp/gnome-split-$(VERSION) |
|---|