diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile | 74 | ||||
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | src/Makefile | 51 |
4 files changed, 84 insertions, 60 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c1e90f1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build +src/configs +tmp @@ -1,61 +1,29 @@ -# Makefile should be called directly, passing the following arguments: -# DOCSET_NAME = ... (should be a directory under ./configs) -# optionally: -# BUILD_DIR = ... (create built docsets under the directory BUILDDIR) - -ERROR_DOCSET_NAME = $(error DOCSET_NAME is unset) +ERROR_NO_ARGUMENT = $(error Must pass at least one argument) .phony: err +err: + $(ERROR_NO_ARGUMENT) -ifndef DOCSET_NAME -err: ; $(ERROR_DOCSET_NAME) -endif - -SOURCE_DIR = configs/$(DOCSET_NAME) -BUILD_DIR = . -DOCSET_DIR = $(BUILD_DIR)/$(DOCSET_NAME).docset -CONTENTS_DIR = $(DOCSET_DIR)/Contents -RESOURCES_DIR = $(CONTENTS_DIR)/Resources -DOCUMENTS_DIR = $(RESOURCES_DIR)/Documents - -INFO_PLIST_FILE = $(CONTENTS_DIR)/Info.plist -INDEX_FILE = $(RESOURCES_DIR)/docSet.dsidx -ICON_FILE = $(DOCSET_DIR)/icon.png -ARCHIVE_FILE = $(DOCSET_NAME).tgz - -SRC_INFO_PLIST_FILE = $(SOURCE_DIR)/Info.plist - -DOCSET = $(INFO_PLIST_FILE) $(INDEX_FILE) $(ICON_FILE) - -all: $(DOCSET) +BUILD_DIR = build +SRC_MAKE_CALL = $(MAKE) -f src/Makefile BUILD_DIR=$(BUILD_DIR) -ifdef DOCSET_NAME -include configs/$(DOCSET_NAME)/config.mk -endif - -archive: $(ARCHIVE_FILE) +# For this target, only archive docsets that have already been built in BUILD_DIR +.phony: archive +archive: + #TODO +# For this target, simply remove all docsets and tgz files from BUILD_DIR +.phony: clean clean: - rm -rf $(DOCSET_DIR) $(ARCHIVE_FILE) - -tmp: - mkdir -p $@ - -$(ARCHIVE_FILE): $(DOCSET) - tar --exclude='.DS_Store' -czf $@ $(DOCSET_DIR) - -$(DOCSET_DIR): - mkdir -p $@ - -$(CONTENTS_DIR): $(DOCSET_DIR) - mkdir -p $@ + rm -rf $(BUILD_DIR)/*.docset $(BUILD_DIR)/*.tgz -$(RESOURCES_DIR): $(CONTENTS_DIR) - mkdir -p $@ +# All supported docsets should be listed here +.phony: GNU_Make +GNU_Make: $(BUILD_DIR)/GNU_Make.docset -$(INFO_PLIST_FILE): $(SRC_INFO_PLIST_FILE) $(CONTENTS_DIR) - cp $(SRC_INFO_PLIST_FILE) $@ +# All docset files should be listed here +$(BUILD_DIR)/GNU_Make.docset: + $(SRC_MAKE_CALL) DOCSET_NAME=GNU_Make -ifdef SRC_ICON_FILE -$(ICON_FILE): $(SRC_ICON_FILE) $(DOCSET_DIR) - cp $(SRC_ICON_FILE) $@ -endif +# All archive files should be listed here +$(BUILD_DIR)/GNU_Make.tgz: GNU_Make + tar --exclude='.DS_Store' -czf $@ $(BUILD_DIR)/GNU_Make.docset @@ -1,16 +1,18 @@ # Dash Docset Builder -This is a repository providing sources building various Dash docsets using a Makefile. Supported docsets can be found under `./configs`. +This is a repository providing sources building various Dash docsets using a Makefile. Supported docsets can be found under `./src/configs`. Simply pass the name of the docset as a target for the Makefile (e.g., `make GNU_Make`). ### Documentation ``` -Usage: make DOCSET_NAME=... [BUILD_DIR=...] +Usage: make DOCSET_NAME [BUILD_DIR=...] - DOCSET_NAME must be set to the name of a directory under ./configs. - BUILD_DIR can be set to a directory to build under. The default is the project root + DOCSET_NAME must be a directory under ./src/configs. + BUILD_DIR can be set to a directory to build under. The default is ./build -Examples: - make DOCSET_NAME=GNU_Make - make DOCSET_NAME=GNU_Make BUILD_DIR=build/ +Other possible targets: + archive - create .tgz archives for all docsets in BUILD_DIR (WIP) + clean - remove all docsets and .tgz archives from BUILD_DIR + $(BUILD_DIR)/$(DOCSET_NAME).docset - equivalent to DOCSET_NAME + $(BUILD_DIR)/$(DOCSET_NAME).tgz - create a .tgz archive of DOCSET_NAME ``` diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..b479925 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,51 @@ +# If called directly, Makefile should be called passing the following arguments: +# DOCSET_NAME = ... (should be a directory under ./configs) +# BUILD_DIR = ... (create built docsets under the directory BUILD_DIR) + +ERROR_DOCSET_NAME = $(error DOCSET_NAME is unset) +.phony: err + +ifndef DOCSET_NAME +err: ; $(ERROR_DOCSET_NAME) +endif + +SOURCE_DIR = src/configs/$(DOCSET_NAME) +DOCSET_DIR = $(BUILD_DIR)/$(DOCSET_NAME).docset +CONTENTS_DIR = $(DOCSET_DIR)/Contents +RESOURCES_DIR = $(CONTENTS_DIR)/Resources +DOCUMENTS_DIR = $(RESOURCES_DIR)/Documents + +INFO_PLIST_FILE = $(CONTENTS_DIR)/Info.plist +INDEX_FILE = $(RESOURCES_DIR)/docSet.dsidx +ICON_FILE = $(DOCSET_DIR)/icon.png +ARCHIVE_FILE = $(DOCSET_NAME).tgz + +SRC_INFO_PLIST_FILE = $(SOURCE_DIR)/Info.plist + +DOCSET = $(INFO_PLIST_FILE) $(INDEX_FILE) $(ICON_FILE) + +all: $(DOCSET) + +ifdef DOCSET_NAME +include src/configs/$(DOCSET_NAME)/config.mk +endif + +tmp: + mkdir -p $@ + +$(DOCSET_DIR): + mkdir -p $@ + +$(CONTENTS_DIR): $(DOCSET_DIR) + mkdir -p $@ + +$(RESOURCES_DIR): $(CONTENTS_DIR) + mkdir -p $@ + +$(INFO_PLIST_FILE): $(SRC_INFO_PLIST_FILE) $(CONTENTS_DIR) + cp $(SRC_INFO_PLIST_FILE) $@ + +ifdef SRC_ICON_FILE +$(ICON_FILE): $(SRC_ICON_FILE) $(DOCSET_DIR) + cp $(SRC_ICON_FILE) $@ +endif |