Skip to content

chore: update Makefile and flox environment #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flox/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ run/
cache/
lib/
log/
!env/
164 changes: 21 additions & 143 deletions .flox/env/manifest.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"clang-tools": {
"pkg-path": "clang-tools"
},
"entr": {
"pkg-path": "entr"
},
"gcc": {
"pkg-path": "gcc"
},
Expand Down Expand Up @@ -39,6 +36,7 @@
"build": {
"t3": {
"command": " make\n make test\n make install PREFIX=$out\n",
"runtime-packages": [],
"sandbox": "pure"
}
}
Expand Down Expand Up @@ -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,
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
61 changes: 8 additions & 53 deletions .flox/env/manifest.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -42,6 +42,9 @@ install: $(INSTBIN) $(INSTMAN1)
lint: $(BIN).c
clang-tidy $< -- $(CFLAGS)

format: $(BIN).c
clang-format -i $<
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be good to add this to CI if more people are working on this in the future but not an issue for now


clean:
-rm -f $(BIN) $(MAN1)

Expand Down
11 changes: 10 additions & 1 deletion t3.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
* to the provided filename and to its own stdout and stderr streams.
*/

/*
* Include <TargetConditionals.h> to address error:
* 'TARGET_OS_IPHONE' is not defined
* https://developer.apple.com/documentation/xcode/identifying-and-addressing-framework-module-issues
*/
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif

#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
Expand Down Expand Up @@ -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++;
Expand Down