diff --git a/.flox/.gitignore b/.flox/.gitignore index 15d71a1..8d21186 100644 --- a/.flox/.gitignore +++ b/.flox/.gitignore @@ -2,3 +2,4 @@ run/ cache/ lib/ log/ +!env/ diff --git a/.flox/env/manifest.lock b/.flox/env/manifest.lock index 9366d6a..4698b3a 100644 --- a/.flox/env/manifest.lock +++ b/.flox/env/manifest.lock @@ -6,9 +6,6 @@ "clang-tools": { "pkg-path": "clang-tools" }, - "entr": { - "pkg-path": "entr" - }, "gcc": { "pkg-path": "gcc" }, @@ -39,6 +36,7 @@ "build": { "t3": { "command": " make\n make test\n make install PREFIX=$out\n", + "runtime-packages": [], "sandbox": "pure" } } @@ -164,126 +162,6 @@ "group": "toplevel", "priority": 5 }, - { - "attr_path": "entr", - "broken": false, - "derivation": "/nix/store/2m9kxlvcfm29ry5c8wwxjz6m7idkjv6j-entr-5.2.drv", - "description": "Run arbitrary commands when files change", - "install_id": "entr", - "license": "ISC", - "locked_url": "https://github.com/flox/nixpkgs?rev=0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", - "name": "entr-5.2", - "pname": "entr", - "rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", - "rev_count": 439146, - "rev_date": "2023-01-02T00:06:23Z", - "scrape_date": "2024-08-16T02:13:46Z", - "stabilities": [ - "staging", - "unstable" - ], - "unfree": false, - "version": "5.2", - "outputs_to_install": [ - "out" - ], - "outputs": { - "out": "/nix/store/w2zxqvwjq135nx9spsji0xjqpb84y0dm-entr-5.2" - }, - "system": "aarch64-darwin", - "group": "toplevel", - "priority": 5 - }, - { - "attr_path": "entr", - "broken": false, - "derivation": "/nix/store/3wbgs8gshr35bkiv5pr2hzjbib5s58nh-entr-5.2.drv", - "description": "Run arbitrary commands when files change", - "install_id": "entr", - "license": "ISC", - "locked_url": "https://github.com/flox/nixpkgs?rev=0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", - "name": "entr-5.2", - "pname": "entr", - "rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", - "rev_count": 439146, - "rev_date": "2023-01-02T00:06:23Z", - "scrape_date": "2024-08-16T02:13:46Z", - "stabilities": [ - "staging", - "unstable" - ], - "unfree": false, - "version": "5.2", - "outputs_to_install": [ - "out" - ], - "outputs": { - "out": "/nix/store/yqm69pda8rl4bbs02vix5h2vk86wwqqd-entr-5.2" - }, - "system": "aarch64-linux", - "group": "toplevel", - "priority": 5 - }, - { - "attr_path": "entr", - "broken": false, - "derivation": "/nix/store/jdafsf78g5qvicdyc6j63ar7brwph91c-entr-5.2.drv", - "description": "Run arbitrary commands when files change", - "install_id": "entr", - "license": "ISC", - "locked_url": "https://github.com/flox/nixpkgs?rev=0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", - "name": "entr-5.2", - "pname": "entr", - "rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", - "rev_count": 439146, - "rev_date": "2023-01-02T00:06:23Z", - "scrape_date": "2024-08-16T02:13:46Z", - "stabilities": [ - "staging", - "unstable" - ], - "unfree": false, - "version": "5.2", - "outputs_to_install": [ - "out" - ], - "outputs": { - "out": "/nix/store/q2j2m17an7b1inqzdm0js2r054ji5n9j-entr-5.2" - }, - "system": "x86_64-darwin", - "group": "toplevel", - "priority": 5 - }, - { - "attr_path": "entr", - "broken": false, - "derivation": "/nix/store/yabgf5jhca8czd150jcmv9rss4nrkx66-entr-5.2.drv", - "description": "Run arbitrary commands when files change", - "install_id": "entr", - "license": "ISC", - "locked_url": "https://github.com/flox/nixpkgs?rev=0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", - "name": "entr-5.2", - "pname": "entr", - "rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", - "rev_count": 439146, - "rev_date": "2023-01-02T00:06:23Z", - "scrape_date": "2024-08-16T02:13:46Z", - "stabilities": [ - "staging", - "unstable" - ], - "unfree": false, - "version": "5.2", - "outputs_to_install": [ - "out" - ], - "outputs": { - "out": "/nix/store/xvzmsmjk8lgzdbzach38za42v5pz65qa-entr-5.2" - }, - "system": "x86_64-linux", - "group": "toplevel", - "priority": 5 - }, { "attr_path": "gcc", "broken": false, @@ -303,10 +181,10 @@ "unstable" ], "unfree": false, - "version": "wrapper-11.3.0", + "version": "11.3.0", "outputs_to_install": [ - "out", - "man" + "man", + "out" ], "outputs": { "info": "/nix/store/ihj6xpggw8cy9gzq1pqwk2353jyvxa77-gcc-wrapper-11.3.0-info", @@ -336,10 +214,10 @@ "unstable" ], "unfree": false, - "version": "wrapper-9.5.0", + "version": "9.5.0", "outputs_to_install": [ - "out", - "man" + "man", + "out" ], "outputs": { "info": "/nix/store/k280mzgbhda3la8qp9jvfgm71rfvqi8x-gcc-wrapper-9.5.0-info", @@ -369,10 +247,10 @@ "unstable" ], "unfree": false, - "version": "wrapper-11.3.0", + "version": "11.3.0", "outputs_to_install": [ - "out", - "man" + "man", + "out" ], "outputs": { "info": "/nix/store/yih14rjv4rgmg4n76ljgwy848mr1p8hp-gcc-wrapper-11.3.0-info", @@ -402,10 +280,10 @@ "unstable" ], "unfree": false, - "version": "wrapper-11.3.0", + "version": "11.3.0", "outputs_to_install": [ - "out", - "man" + "man", + "out" ], "outputs": { "info": "/nix/store/mhyxwk72p093hpv563cj1rmbpfmhpw8a-gcc-wrapper-11.3.0-info", @@ -557,8 +435,8 @@ "unfree": false, "version": "4.4", "outputs_to_install": [ - "out", - "man" + "man", + "out" ], "outputs": { "info": "/nix/store/xjpcray0p1zrpa9sadjcp7d7nzzlv21i-gnumake-4.4-info", @@ -590,8 +468,8 @@ "unfree": false, "version": "4.4", "outputs_to_install": [ - "out", - "man" + "man", + "out" ], "outputs": { "debug": "/nix/store/37a9n7r9zn3szhgz9dgr2n7h2bwhs715-gnumake-4.4-debug", @@ -624,8 +502,8 @@ "unfree": false, "version": "4.4", "outputs_to_install": [ - "out", - "man" + "man", + "out" ], "outputs": { "info": "/nix/store/6z4zn7r258b5h3hqi8z9pb6vlib19mfh-gnumake-4.4-info", @@ -657,8 +535,8 @@ "unfree": false, "version": "4.4", "outputs_to_install": [ - "out", - "man" + "man", + "out" ], "outputs": { "debug": "/nix/store/frnlf8flm2q084dcgm1vvkgap4j7wkw3-gnumake-4.4-debug", diff --git a/.flox/env/manifest.toml b/.flox/env/manifest.toml index b653edf..9ea2b06 100644 --- a/.flox/env/manifest.toml +++ b/.flox/env/manifest.toml @@ -1,68 +1,23 @@ -# -# This is a Flox environment manifest. -# Visit flox.dev/docs/concepts/manifest/ -# or see flox-edit(1), manifest.toml(5) for more information. -# -# Flox manifest version managed by Flox CLI version = 1 -# List packages you wish to install in your environment inside -# the `[install]` section. [install] clang-tools.pkg-path = "clang-tools" -entr.pkg-path = "entr" gcc.pkg-path = "gcc" -gnumake.pkg-path = "gnumake" gdb.pkg-path = "gdb" +gnumake.pkg-path = "gnumake" help2man.pkg-path = "help2man" -# Set environment variables in the `[vars]` section. These variables may not -# reference one another, and are added to the environment without first -# expanding them. They are available for use in the `[profile]` and `[hook]` -# scripts. -[vars] -# message = "Howdy" - -# The `hook.on-activate` script is run by the *bash* shell immediately upon -# activating an environment, and will not be invoked if Flox detects that the -# environment has previously been activated. Variables set by the script will -# be inherited by `[profile]` scripts defined below. Note that any stdout -# generated by the script will be redirected to stderr. -[hook] -# on-activate = ''' -# # Set variables, create files and directories -# venv_dir="$(mktemp -d)" -# export venv_dir -# -# # Perform initialization steps, e.g. create a python venv -# python -m venv "$venv_dir" -# ''' - -# Scripts defined in the `[profile]` section are *sourced* by *your shell* and -# inherit environment variables set in the `[vars]` section and by `[hook]` scripts. -# The `profile.common` script is sourced by all shells and special care should be -# taken to ensure compatibility with all shells, after which exactly one of -# `profile.{bash,fish,tcsh,zsh}` is sourced by the corresponding shell. -[profile] -# common = ''' -# echo "it's gettin' flox in here" -# ''' - -# The `[services]` section of the manifest allows you to define services. -# Services defined here use the packages provided by the `[install]` section -# and any variables you've defined in the `[vars]` section or `hook.on-activate` script. -[services] -# postgres.command = "postgres --config-file=pg.conf" - -# Additional options can be set in the `[options]` section. Refer to -# manifest.toml(5) for a list of available options. [options] -systems = ["aarch64-darwin", "aarch64-linux", "x86_64-darwin", "x86_64-linux"] -# Uncomment to disable CUDA detection. -# cuda-detection = false +systems = [ + "aarch64-darwin", + "aarch64-linux", + "x86_64-darwin", + "x86_64-linux", +] [build] t3.sandbox = "pure" +t3.runtime-packages = [] t3.command = ''' make make test diff --git a/Makefile b/Makefile index 06e6c20..972f39d 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ - .DEFAULT_GOAL = all NAME = t3 +VERSION ?= unknown PREFIX ?= /usr/local -CFLAGS = -Wall -g +CFLAGS = -Wall -g -DVERSION='"$(VERSION)"' BINDIR = $(PREFIX)/bin BIN = $(NAME) @@ -42,6 +42,9 @@ install: $(INSTBIN) $(INSTMAN1) lint: $(BIN).c clang-tidy $< -- $(CFLAGS) +format: $(BIN).c + clang-format -i $< + clean: -rm -f $(BIN) $(MAN1) diff --git a/t3.c b/t3.c index 8864002..9b05027 100644 --- a/t3.c +++ b/t3.c @@ -20,6 +20,15 @@ * to the provided filename and to its own stdout and stderr streams. */ +/* + * Include to address error: + * 'TARGET_OS_IPHONE' is not defined + * https://developer.apple.com/documentation/xcode/identifying-and-addressing-framework-module-issues + */ +#ifdef __APPLE__ +#include +#endif + #include #include #include @@ -425,7 +434,7 @@ int main(int argc, char *argv[]) { usage(EXIT_SUCCESS); break; case 'v': - printf("t3 version 1.0\n"); + puts(VERSION); exit(EXIT_SUCCESS); case 'x': debuglevel++;