]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/Makefile
Update debian/copyright
[dactyl.git] / common / Makefile
index 955d358a7b9acb1925afca94585634387b0b8ca5..0251c4ab3ce210e14c1b17c5665c456052a80f88 100644 (file)
@@ -1,14 +1,22 @@
 #### configuration
 
+
+AWK       ?= awk
+B64ENCODE ?= base64
+CURL      ?= curl
+SED       := $(shell if [ "xoo" = x$$(echo foo | sed -E 's/f(o)/\1/' 2>/dev/null) ]; \
+                    then echo sed -E; else echo sed -r;                             \
+                    fi)
+
 TOP           = $(shell pwd)
 OS            = $(shell uname -s)
 BUILD_DATE    = $(shell date "+%Y/%m/%d %H:%M:%S")
 BASE          = $(TOP)/../common
 GOOGLE_PROJ   = dactyl
 GOOGLE       = https://$(GOOGLE_PROJ).googlecode.com/files
-VERSION             ?= $(shell sed -n 's/.*em:version\(>\|="\)\(.*\)["<].*/\2/p' $(TOP)/install.rdf | sed 1q)
-UUID                := $(shell sed -n 's/.*em:id\(>\|="\)\(.*\)["<].*/\2/p' $(TOP)/install.rdf | sed 1q)
-MANGLE      := $(shell date '+%s' | awk '{ printf "%x", $$1 }')
+VERSION             ?= $(shell $(SED) -n 's/.*em:version(>|=")(.*)["<].*/\2/p' $(TOP)/install.rdf | sed 1q)
+UUID                := $(shell $(SED) -n 's/.*em:id(>|=")(.*)["<].*/\2/p' $(TOP)/install.rdf | sed 1q)
+MANGLE      := chrome
 MOZMILL       = mozmill
 HOSTAPP_PATH  = $(shell which $(HOSTAPP))
 TEST_DIR      = $(BASE)/tests/functional
@@ -24,15 +32,16 @@ MAKE_JAR      = sh $(BASE)/make_jar.sh
 
 # TODO: specify source files manually?
 JAR_BASES     = $(TOP) $(BASE)
+JAR_FILES     = config.json
 JAR_DIRS      = content skin locale modules
-JAR_TEXTS     = js jsm css dtd xml xul html xhtml xsl properties
+JAR_TEXTS     = js jsm css dtd xml xul html xhtml xsl properties json
 JAR_BINS      = png
 
 CHROME       = $(MANGLE)/
 JAR           = $(CHROME)$(NAME).jar
 
 XPI_BASES     = $(JAR_BASES) $(TOP)/..
-XPI_FILES     = bootstrap.js TODO AUTHORS Donors NEWS LICENSE.txt
+XPI_FILES     = icon.png icon64.png bootstrap.js TODO AUTHORS Donors NEWS LICENSE.txt
 XPI_DIRS      = components $(MANGLE) defaults
 XPI_TEXTS     = js jsm $(JAR_TEXTS)
 XPI_BINS      = $(JAR_BINS)
@@ -41,18 +50,8 @@ XPI_NAME      = $(NAME)-$(VERSION)
 XPI           =  ../downloads/$(XPI_NAME).xpi
 XPI_PATH      = $(TOP)/$(XPI:%.xpi=%)
 
-RDF           = ../downloads/update.rdf
-RDF_IN        = $(RDF).in
-
 BUILD_DIR     = build.$(VERSION).$(OS)
 
-AWK       ?= awk
-B64ENCODE ?= base64
-CURL      ?= curl
-SED       := $(shell if [ "xoo" = x$$(echo foo | sed -E 's/f(o)/\1/' 2>/dev/null) ]; \
-                    then echo sed -E; else echo sed -r;                             \
-                    fi)
-
 .SILENT:
 
 #### rules
@@ -76,7 +75,6 @@ help:
        @echo "  make install    - installs this source tree directly to your $(HOSTAPP) profile"
        @echo '                    set $$PROFILE to select a profile by name and $$PROFILEPATHS'
        @echo '                    to change the directory where profiles are searched'
-       @echo "  make release    - updates update.rdf (this is not for you)"
        @echo "  make dist       - uploads to Google Code (this is not for you)"
        @echo "  make clean      - clean up"
        @echo "  make distclean  - clean up more"
@@ -92,8 +90,6 @@ info:
 
 jar: $(JAR)
 
-release: $(XPI) $(RDF)
-
 # This is not for you!
 dist: $(XPI)
        @echo DIST $(XPI) $(GOOGLE)
@@ -121,7 +117,7 @@ install:
        done;                                                                   \
                                                                                \
        profile=$$(sed 's/^$$/\#/' "$$dir/profiles.ini" |                       \
-               awk -v"profile=$(PROFILE)"                                      \
+               awk -v "profile=$(PROFILE)"                                     \
                        'BEGIN { RS="#" }                                       \
                        index($$0, "\nName=" profile "\n") { print; exit }      \
                        !profile && /\nName=default\n/ { args["name=default"] = $$0 }   \
@@ -141,24 +137,23 @@ install:
                exit 1;                                                         \
        fi;                                                                     \
                                                                                \
-       ext="$$profile/extensions/$(UUID)";                                     \
-       mkdir -p "$$(dirname "$$ext")";                                         \
-       rm -rf "$$ext.xpi" "$$ext";                                             \
-       echo "Installing to $$ext";                                             \
-       if which cygpath >/dev/null 2>&1;                                       \
-       then cygpath -wa .;                                                     \
-       else pwd;                                                               \
-       fi >"$$ext"
+       install() {                                                             \
+               ext="$$profile/extensions/$$2";                                 \
+               mkdir -p "$$(dirname "$$ext")";                                 \
+               rm -rf "$$ext.xpi" "$$ext";                                     \
+                                                                               \
+               echo "Installing $$2 to $$ext";                                 \
+               if which cygpath >/dev/null 2>&1;                               \
+               then cygpath -wa $$1;                                           \
+               else (cd $$1; pwd);                                             \
+               fi >"$$ext";                                                    \
+       };                                                                      \
+       install . $(UUID);                                                      \
+       install ../binary binary@dactyl.googlecode.com;                         \
+
 installxpi: xpi
        $(HOSTAPP) $(XPI)
 
-$(RDF): $(RDF_IN) Makefile
-       @echo "Preparing release..."
-       $(SED) -e "s,@VERSION@,$(VERSION),g" \
-                  -e "s,@DATE@,$(BUILD_DATE),g" \
-                  < $< > $@
-       @echo "SUCCESS: $@"
-
 clean:
        @echo "General $(NAME) cleanup..."
        rm -f $(JAR) $(XPI)
@@ -177,11 +172,11 @@ test: xpi
 xpi: $(CHROME)
        @echo "Building XPI..."
        mkdir -p "$(XPI_PATH)"
-       
+
        $(AWK) -v 'name=$(NAME)' -v 'suffix=$(MANGLE)' \
               -f $(BASE)/process_manifest.awk \
               "$(TOP)/chrome.manifest" >"$(XPI_PATH)/chrome.manifest"
-       
+
        version="$(VERSION)";                   \
        hg root >/dev/null 2>&1 &&              \
        case "$$version" in                     \
@@ -189,7 +184,7 @@ xpi: $(CHROME)
        esac;                                   \
        $(SED) -e 's/(em:version(>|="))([^"<]+)/\1'"$$version/" \
                <"$(TOP)/install.rdf" >"$(XPI_PATH)/install.rdf"
-       
+
        $(MAKE_JAR) "$(XPI)" "$(XPI_BASES)" "$(XPI_DIRS)" "$(XPI_TEXTS)" "$(XPI_BINS)" "$(XPI_FILES)"
        rm -r -- $(CHROME)
        @echo "Built XPI: $(XPI)"