Created
September 12, 2018 02:58
-
-
Save Youngestdev/808fe93ddd5076dc3aa3396b5d866577 to your computer and use it in GitHub Desktop.
Dynamic module makefile
This file contains hidden or 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
| # This makefiile generates the following dynamic libraries: | |
| # - archiver | |
| # - consoler | |
| # - file_savant | |
| # - mathic | |
| # - string_savant | |
| # - networker | |
| # - parser | |
| # - security | |
| # - systemic | |
| # - core_dynamic_module | |
| # - fulltick | |
| # | |
| # NOTE: | |
| # If you are modifying this file always build fulltick last, however | |
| # fulltick is currently not building well because it appears it relies on | |
| # the existence of preceding librarires. | |
| # So I've excluded from DYNAMIC_MODULES_FOLDERS. `fulltick`'s module is currently not | |
| # being built. | |
| # | |
| # TODO: | |
| # Fix `fulltick`'s makefile and make it the last entry DYNAMIC_MODULES_FOLDERS. | |
| PROGRAM_NAME := simple | |
| VER := 0.3.36 | |
| VAR_BASE_DIR := /var/lib/$(PROGRAM_NAME)/s$(VER) | |
| VAR_SIMPLE_DIR := $(VAR_BASE_DIR)/modules | |
| VAR_DYNAMIC_MODULES_DIR := $(VAR_SIMPLE_DIR)/dynamic_modules | |
| DIST := ../dist | |
| MODULE_DIR := ../.. | |
| DYNAMIC_MODULES_DIR := .. | |
| DYNAMIC_MODULES_EXCLUDE := $(addprefix $(DYNAMIC_MODULES_DIR)/,dist makefiles consoler systemic fulltick) | |
| DYNAMIC_MODULES_FOLDERS := $(filter-out $(DYNAMIC_MODULES_EXCLUDE), $(wildcard $(DYNAMIC_MODULES_DIR)/*)) | |
| LIB_FILES := $(addprefix $(DIST)/,$(notdir $(DYNAMIC_MODULES_FOLDERS:%=%.so))) | |
| # Folder creation commands | |
| CREATE_BUILD_DIR := mkdir -p $(DIST)/build | |
| CREATE_VAR_SIMPLE_DIR := mkdir -p $(VAR_BASE_DIR)/docs | |
| # Compile commands | |
| RECURSIVE_MAKE = $(MAKE) -f Makefile-Unix.mk -C $(DYNAMIC_MODULES_DIR)/$* | |
| # .SILENT: | |
| $(DIST)/%.so: $(DYNAMIC_MODULES_DIR)/% | |
| $(RECURSIVE_MAKE) | |
| build: $(LIB_FILES) | |
| install: $(LIB_FILES) | |
| $(CREATE_VAR_SIMPLE_DIR) | |
| rsync -q -av $(MODULE_DIR) $(VAR_SIMPLE_DIR) --exclude README.md --exclude dynamic_modules | |
| rsync -q -av $(LIB_FILES) $(VAR_DYNAMIC_MODULES_DIR) | |
| sudo chmod -R 777 /var/lib/$(PROGRAM_NAME)/ | |
| clean: | |
| rm -rf $(DIST) | |
| $(CREATE_BUILD_DIR) | |
| # NOTE: | |
| # We don't remove the main simple directory from /var/lib because it | |
| # it may contain dependencies and modules for another simple version | |
| uninstall: | |
| rm -r -f $(VAR_BASE_DIR) | |
| all: uninstall clean install clean | |
| .PHONY: build all uninstall install clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment