This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Makefile: add .build dir, usage preprocessor.py
- Loading branch information
Showing
2 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.build/ | ||
*.xpi | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |