{"id":28759716,"url":"https://github.com/cemkeylan/redo-lib","last_synced_at":"2025-10-20T01:55:51.294Z","repository":{"id":215865111,"uuid":"324354807","full_name":"cemkeylan/redo-lib","owner":"cemkeylan","description":"Helper functions for the redo build system","archived":false,"fork":false,"pushed_at":"2020-12-25T12:14:32.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-01-08T04:21:11.834Z","etag":null,"topics":["build-system","djb","makefile","redo"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cemkeylan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-12-25T12:05:54.000Z","updated_at":"2020-12-25T12:14:34.000Z","dependencies_parsed_at":"2024-01-07T04:05:33.120Z","dependency_job_id":"ed8a15f7-e5af-401a-ad51-8dfb8fef20cb","html_url":"https://github.com/cemkeylan/redo-lib","commit_stats":null,"previous_names":["cemkeylan/redo-lib"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/cemkeylan/redo-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemkeylan%2Fredo-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemkeylan%2Fredo-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemkeylan%2Fredo-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemkeylan%2Fredo-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cemkeylan","download_url":"https://codeload.github.com/cemkeylan/redo-lib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemkeylan%2Fredo-lib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260294461,"owners_count":22987624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-system","djb","makefile","redo"],"created_at":"2025-06-17T05:08:07.743Z","updated_at":"2025-10-20T01:55:51.226Z","avatar_url":"https://github.com/cemkeylan.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"redo-lib\n========\n\n`redo-lib` is a set of helper functions one can incorporate to their source code\nto complement the [redo] build system.\n\n\n[redo]: http://cr.yp.to/redo.html\n\n\u003c!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc --\u003e\n**Table of Contents**\n\n- [redo-lib](#redo-lib)\n    - [Installation](#installation)\n    - [Using redo-lib](#using-redo-lib)\n        - [setv](#setv)\n        - [PHONY](#phony)\n        - [expsuf](#expsuf)\n        - [repsuf](#repsuf)\n        - [targcheck](#targcheck)\n    - [Copying](#copying)\n\n\u003c!-- markdown-toc end --\u003e\n\n\nInstallation\n------------\n\nYou can include this library by either copying bits into your `.do` files, or by\ncopying the file into your repository and calling it from your build files:\n\n``` sh\n# It is also sensible to add the library as a dependency as well.\nredo-ifchange redo-lib.sh\n. ./redo-lib.sh\n```\n\n\nUsing redo-lib\n--------------\n\nredo-lib saves `$target`, `$basename`, and the `$dest` variables to avoid\ndepending on positional arguments. `$basename` isn't used internally inside any\nfunctions, but it is set nonetheless. Below are explanations of functions\ndefined by `redo-lib`.\n\n\n### setv\n\n`setv()` is similar to how `make` parses variables. You can use operators such\nas `+=` or `?=` in order to interact with variables. Here is a real world\nexample:\n\n``` sh\n# Set VERSION\nsetv VERSION = 1.0\n\n# Set CFLAGS if unset by the user.\nsetv CFLAGS ?= -std=c99 -Wpedantic -Wall\n\n# Append the following values to CFLAGS\nsetv CFLAGS += -DVERSION=\\\"${VERSION}\"\n```\n\n\n### PHONY\n\n`PHONY()` acts similar to the `make` `.PHONY:` targets. All it does is basically\nsetting a trap to remove `$3` on exit. If one or more arguments are given,\n`PHONY` will ignore the given targets. If no argument is supplied, PHONY will\nignore the current target.\n\n``` sh\n# Ignore non-file targets.\nPHONY all install uninstall\n\n# Ignore the current operation.\nPHONY\n\n# Ignore the current operation by checking the build target on 'default.do'\ncase \"$1\" in\n    all)\n        redo-ifchange your-program docs/your-documentation.info\n        PHONY\n        ;;\nesac\n```\n\n### expsuf\n\n`expsuf()` can be used to add a suffix to the given list. The first argument is\nused to store the suffix, and the rest of the arguments are added the suffix.\n\n``` sh\nsetv BIN = bin/myprog \\\n           bin/myotherprog\n           \nsetv SRC = $(expsuf .c ${BIN})\n```\n\n\n### repsuf\n\n`repsuf()` can be used to replace the suffix of the given list. The first\nargument is used to store the old suffix and the second argument is used to\nstore the new suffix, and the rest of the arguments are used to replace them.\n\n``` sh\nsetv SRC = src/myobj.c \\\n           src/mysecobj.c\n           \nsetv OBJ = $(repsuf .c .o ${SRC})\n```\n\n### targcheck\n\n`targcheck()` checks whether the current target is one of the given arguments,\nand returns with status 0 on success.\n\n``` sh\n# On the file 'clean.do', this will return success\ntargcheck all clean install\n\n# On the file 'obj.o.do', this will return failure\ntargcheck obj2.o\n```\n\n\nCopying\n-------\n\nThis library of helper functions are on the public domain so that anyone willing\nto incorporate it into their source code can freely do so.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemkeylan%2Fredo-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcemkeylan%2Fredo-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemkeylan%2Fredo-lib/lists"}