Browse Source

BUILD_TARGET; 'make' works now; README update

Artur Adib 14 years ago
parent
commit
b8a1b3fa5c
  1. 19
      Makefile
  2. 18
      README.md

19
Makefile

@ -1,12 +1,14 @@
REPO = git@github.com:andreasgal/pdf.js.git REPO = git@github.com:andreasgal/pdf.js.git
BUILD_DIR := build BUILD_DIR := build
PDFJS_TARGET := $(BUILD_DIR)/pdf.js BUILD_TARGET := $(BUILD_DIR)/pdf.js
DEFAULT_BROWSERS := resources/browser_manifests/browser_manifest.json DEFAULT_BROWSERS := resources/browser_manifests/browser_manifest.json
DEFAULT_TESTS := test_manifest.json DEFAULT_TESTS := test_manifest.json
EXTENSION_SRC := ./extensions/firefox EXTENSION_SRC := ./extensions/firefox
EXTENSION_NAME := pdf.js.xpi EXTENSION_NAME := pdf.js.xpi
all: bundle
# Let folks define custom rules for their clones. # Let folks define custom rules for their clones.
-include local.mk -include local.mk
@ -45,7 +47,7 @@ test: shell-test browser-test
# Create production output (pdf.js, and corresponding changes to web files) # Create production output (pdf.js, and corresponding changes to web files)
# #
production: | bundle production: | bundle
@echo "Preparing viewer-production.html..."; \ @echo "Preparing web/viewer-production.html"; \
cd web; \ cd web; \
sed '/PDFJSSCRIPT_REMOVE/d' viewer.html > viewer-1.tmp; \ sed '/PDFJSSCRIPT_REMOVE/d' viewer.html > viewer-1.tmp; \
sed '/PDFJSSCRIPT_INCLUDE_BUILD/ r viewer-snippet.html' viewer-1.tmp > viewer-production.html; \ sed '/PDFJSSCRIPT_INCLUDE_BUILD/ r viewer-snippet.html' viewer-1.tmp > viewer-production.html; \
@ -55,12 +57,11 @@ production: | bundle
# #
# Bundle pdf.js # Bundle pdf.js
# #
bundle: bundle: | $(BUILD_DIR)
@echo "Bundling source files into pdf.js..." @echo "Bundling source files into $(BUILD_TARGET)"
@mkdir -p $(BUILD_DIR)
@cd src; \ @cd src; \
cat $(PDF_JS_FILES) > all_files.tmp; \ cat $(PDF_JS_FILES) > all_files.tmp; \
sed '/PDFJSSCRIPT_INCLUDE_ALL/ r all_files.tmp' pdf.js > ../$(PDFJS_TARGET); \ sed '/PDFJSSCRIPT_INCLUDE_ALL/ r all_files.tmp' pdf.js > ../$(BUILD_TARGET); \
rm -f *.tmp; \ rm -f *.tmp; \
cd .. cd ..
@ -139,7 +140,7 @@ lint:
# #
GH_PAGES = $(BUILD_DIR)/gh-pages GH_PAGES = $(BUILD_DIR)/gh-pages
web: | production extension compiler pages-repo \ web: | production extension compiler pages-repo \
$(addprefix $(GH_PAGES)/, $(PDFJS_TARGET)) \ $(addprefix $(GH_PAGES)/, $(BUILD_TARGET)) \
$(addprefix $(GH_PAGES)/, $(wildcard web/*.*)) \ $(addprefix $(GH_PAGES)/, $(wildcard web/*.*)) \
$(addprefix $(GH_PAGES)/, $(wildcard web/images/*.*)) \ $(addprefix $(GH_PAGES)/, $(wildcard web/images/*.*)) \
$(addprefix $(GH_PAGES)/, $(wildcard $(EXTENSION_SRC)/*.xpi)) $(addprefix $(GH_PAGES)/, $(wildcard $(EXTENSION_SRC)/*.xpi))
@ -210,7 +211,7 @@ extension: | production
@rm -Rf $(EXTENSION_SRC)/$(CONTENT_DIR)/ @rm -Rf $(EXTENSION_SRC)/$(CONTENT_DIR)/
@mkdir -p $(EXTENSION_SRC)/$(CONTENT_DIR)/$(BUILD_DIR) @mkdir -p $(EXTENSION_SRC)/$(CONTENT_DIR)/$(BUILD_DIR)
@mkdir -p $(EXTENSION_SRC)/$(CONTENT_DIR)/web @mkdir -p $(EXTENSION_SRC)/$(CONTENT_DIR)/web
@cp $(PDFJS_TARGET) $(EXTENSION_SRC)/$(CONTENT_DIR)/$(BUILD_DIR) @cp $(BUILD_TARGET) $(EXTENSION_SRC)/$(CONTENT_DIR)/$(BUILD_DIR)
@cp -r $(PDF_WEB_FILES) $(EXTENSION_SRC)/$(CONTENT_DIR)/web/ @cp -r $(PDF_WEB_FILES) $(EXTENSION_SRC)/$(CONTENT_DIR)/web/
@mv -f $(EXTENSION_SRC)/$(CONTENT_DIR)/web/viewer-production.html $(EXTENSION_SRC)/$(CONTENT_DIR)/web/viewer.html @mv -f $(EXTENSION_SRC)/$(CONTENT_DIR)/web/viewer-production.html $(EXTENSION_SRC)/$(CONTENT_DIR)/web/viewer.html
@ -232,5 +233,5 @@ clean:
help: help:
@echo "Read the comments in the Makefile for guidance."; @echo "Read the comments in the Makefile for guidance.";
.PHONY:: production watch test browser-test font-test shell-test \ .PHONY:: production test browser-test font-test shell-test \
shell-msg lint clean web compiler help server shell-msg lint clean web compiler help server

18
README.md

@ -59,22 +59,16 @@ You can also view all the test pdf files on the right side serving
In order to bundle all `src/` files into a final `pdf.js`, issue: In order to bundle all `src/` files into a final `pdf.js`, issue:
$ make bundle $ make
This will generate the file `build/pdf.js` that can be included in your final project. (WARNING: That's a large file! Consider minifying it). This will generate the file `build/pdf.js` that can be included in your final project. (WARNING: That's a large file! Consider minifying it).
## Learning ## Learning
Here are some initial pointers to help contributors get off the ground. Here are some initial pointers to help contributors get off the ground.
Additional resources are available in a separate section below. Additional resources are available in a separate section below.
#### Introductory video
Check out the presentation by our contributor Julian Viereck on the inner
workings of PDF and pdf.js:
+ http://www.youtube.com/watch?v=Iv15UY-4Fg8
#### Hello world #### Hello world
For a "hello world" example, take a look at: For a "hello world" example, take a look at:
@ -84,6 +78,14 @@ For a "hello world" example, take a look at:
This example illustrates the bare minimum ingredients for integrating pdf.js This example illustrates the bare minimum ingredients for integrating pdf.js
in a custom project. in a custom project.
#### Introductory video
Check out the presentation by our contributor Julian Viereck on the inner
workings of PDF and pdf.js:
+ http://www.youtube.com/watch?v=Iv15UY-4Fg8
## Contributing ## Contributing

Loading…
Cancel
Save