Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
Change Makefile: add .build dir, usage preprocessor.py
Browse files Browse the repository at this point in the history
  • Loading branch information
seleznev committed Mar 9, 2014
1 parent 915a964 commit b260ecf
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
.build/
*.xpi
*.pyc
50 changes: 45 additions & 5 deletions Makefile
@@ -1,9 +1,49 @@
all: xpi
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

xpi:
cd "extension"; \
zip -FS -r "../firefox-extension-htitle.xpi" *; \
XPI = "firefox-extension-htitle.xpi"

DIRS = $(shell find extension/ -type d)
DIRS := $(filter-out extension/chrome/skin/shared, $(DIRS))

INCLUDES = $(shell find extension/ -type f -name '*.css.inc')

FILES = $(shell find extension/ -type f ! -name '*.css.inc')

TARGET_DIRS = $(patsubst extension/%, .build/%, $(DIRS))
TARGET_FILES = $(patsubst extension/%, .build/%, $(FILES))

all: prepare $(TARGET_DIRS) $(TARGET_FILES) $(XPI)

prepare:
@mkdir -p ".build/"

$(TARGET_DIRS):
@echo Create directory "$@"
@mkdir -p "$@"

.build/%.css: extension/%.css $(INCLUDES)
@echo Convert "$<" to "$@"
@python2 preprocessor.py --marker="%" \
--output="$@" "$<"

.build/%: extension/%
@echo Copy "$<" to "$@"
@cp "$<" "$@"

$(XPI):
@echo Create $(XPI)
@cd ".build/"; \
zip -FS -r "../$(XPI)" *; \
cd ..

.PHONY : clean

clean:
rm -f "firefox-extension-htitle.xpi"
@echo Remove $(XPI)
@rm -f $(XPI)
@echo Remove .build/
@rm -rf ".build"
@echo Remove *.pyc
@rm -f *.pyc

0 comments on commit b260ecf

Please sign in to comment.