Skip to content

Commit

Permalink
Fixed up Makefile and then decided to just write a shell script instead
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-p committed May 18, 2014
1 parent de0b83d commit fb7b49c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
34 changes: 17 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@


PACKAGE_NAME = markdown-here
THUNDERBIRD_PACKAGE_NAME = $(PACKAGE_NAME)-thunderbird.xpi
MOZILLA_PACKAGE_NAME = $(PACKAGE_NAME)-mozilla.xpi
CHROME_PACKAGE_NAME = $(PACKAGE_NAME)-chrome.zip
POSTBOX_PACKAGE_NAME = $(PACKAGE_NAME)-postbox.xpi
DIST_DIR = dist
SRC_DIR = src
TEST_DIR = $(SRC_DIR)/common/test

.PHONY: all dirs chrome postbox thunderbird clean
ZIP_ARGS = -r -1

MOZILLA_INPUT = chrome.manifest install.rdf common firefox
CHROME_INPUT = manifest.json common chrome _locales

.PHONY: all dirs chrome mozilla clean

# Targets for creating directories
dirs: $(DIST_DIR)
Expand All @@ -21,28 +26,23 @@ $(DIST_DIR):
mkdir $(DIST_DIR)

chrome: | dirs
rm -f $(DIST_DIR)/$(CHROME_PACKAGE_NAME)
rm -f $(DIST_DIR)/$(CHROME_PACKAGE_NAME); \
cd $(SRC_DIR); \
zip -r ../$(DIST_DIR)/$(CHROME_PACKAGE_NAME) manifest.json \
zip -r ../$(DIST_DIR)/$(CHROME_PACKAGE_NAME) common/* \
zip -r ../$(DIST_DIR)/$(CHROME_PACKAGE_NAME) chrome/*
zip $(ZIP_ARGS) "../$(DIST_DIR)/$(CHROME_PACKAGE_NAME)" $(CHROME_INPUT)

thunderbird: | dirs
rm -f $(DIST_DIR)/$(THUNDERBIRD_PACKAGE_NAME)
mozilla: | dirs
rm -f $(DIST_DIR)/$(MOZILLA_PACKAGE_NAME); \
cd $(SRC_DIR); \
zip -r ../$(DIST_DIR)/$(THUNDERBIRD_PACKAGE_NAME) chrome.manifest \
zip -r ../$(DIST_DIR)/$(THUNDERBIRD_PACKAGE_NAME) install.rdf \
zip -r ../$(DIST_DIR)/$(THUNDERBIRD_PACKAGE_NAME) common/* \
zip -r ../$(DIST_DIR)/$(THUNDERBIRD_PACKAGE_NAME) firefox/*
zip $(ZIP_ARGS) "../$(DIST_DIR)/$(MOZILLA_PACKAGE_NAME)" $(MOZILLA_INPUT)

postbox: thunderbird
cp -f $(DIST_DIR)/$(THUNDERBIRD_PACKAGE_NAME) $(DIST_DIR)/$(POSTBOX_PACKAGE_NAME)
cd $(SRC_DIR)/postbox; \
zip -r ../../$(DIST_DIR)/$(POSTBOX_PACKAGE_NAME) common/*
#postbox: mozilla
# cp -f $(DIST_DIR)/$(MOZILLA_PACKAGE_NAME) $(DIST_DIR)/$(POSTBOX_PACKAGE_NAME)
# cd $(SRC_DIR)/postbox; \
# zip $(ZIP_ARGS) ../../$(DIST_DIR)/$(POSTBOX_PACKAGE_NAME) common/*

clean:
rm -rf $(DIST_DIR)
find . -name "desktop.ini" -or -name ".*" -and -not -name "." -and -not -name ".git*" -print0 | xargs -0 rm -rf
git checkout -- $(TEST_DIR)

all: clean chrome thunderbird
all: clean chrome mozilla
29 changes: 29 additions & 0 deletions make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

PACKAGE_NAME=markdown-here
MOZILLA_PACKAGE_NAME=${PACKAGE_NAME}-mozilla.xpi
CHROME_PACKAGE_NAME=${PACKAGE_NAME}-chrome.zip
DIST_DIR=dist
SRC_DIR=src
TEST_DIR=${SRC_DIR}/common/test

MOZILLA_INPUT="chrome.manifest install.rdf common firefox"
CHROME_INPUT="manifest.json common chrome _locales"

ZIP_ARGS="-r -1"

rm -rf "${DIST_DIR}"
rm -rf "${TEST_DIR}"
find . -name "desktop.ini" -or -name ".*" -and -not -name "." -and -not -name ".git*" -print0 | xargs -0 rm -rf

mkdir ${DIST_DIR}

cd ${SRC_DIR}

zip ${ZIP_ARGS} "../${DIST_DIR}/${CHROME_PACKAGE_NAME}" ${CHROME_INPUT}

zip ${ZIP_ARGS} "../${DIST_DIR}/${MOZILLA_PACKAGE_NAME}" ${MOZILLA_INPUT}

cd -

git checkout -- "${TEST_DIR}"

0 comments on commit fb7b49c

Please sign in to comment.