Compare commits

...

2 Commits

Author SHA1 Message Date
Aryadev Chavali
739409d3be Use a shell script over a makefile
Simpler build system, easier to read.
2025-11-27 00:45:51 +00:00
Aryadev Chavali
9d8215bd45 Adjusted copyright template for code files 2025-11-27 00:39:01 +00:00
7 changed files with 60 additions and 89 deletions

View File

@@ -2,5 +2,5 @@
;;; For more information see (info "(emacs) Directory Variables")
((nil . ((+license/license-choice . "GNU General Public License Version 2")
(compile-command . "make run")))
(compile-command . "sh build.sh")))
(c++-mode . ((mode . clang-format))))

2
.gitignore vendored
View File

@@ -1,2 +1,2 @@
build/
*.out
TAGS

View File

@@ -1,50 +0,0 @@
CC=g++
OUT=cwtree.out
LIBS=-lm -lraylib
ARGS=
RELEASE=0
GFLAGS=-Wall -Wextra -Wswitch-enum -std=c++17
DFLAGS=-ggdb -fsanitize=address -fsanitize=undefined
RFLAGS=-O3
DEPFLAGS=-MT $@ -MMD -MP -MF
ifeq ($(RELEASE), 1)
CFLAGS=$(GFLAGS) $(RFLAGS)
else
CFLAGS=$(GFLAGS) $(DFLAGS)
endif
SRC=src
DIST=build
CODE=$(addprefix $(SRC)/, numerics.cpp) # add source files here
OBJECTS=$(CODE:$(SRC)/%.cpp=$(DIST)/%.o)
DEPDIR:=$(DIST)/dependencies
DEPS:=$(CODE:$(SRC)/%.cpp=$(DEPDIR):%.d) $(DEPDIR)/main.d
.PHONY: all
all: $(OUT)
$(OUT): $(DIST)/$(OUT)
$(DIST)/$(OUT): $(OBJECTS) $(DIST)/main.o | $(DIST)
$(CC) $(CFLAGS) $^ -o $@ $(LIBS)
$(DIST)/%.o: $(SRC)/%.cpp | $(DIST) $(DEPDIR)
$(CC) $(CFLAGS) $(DEPFLAGS) $(DEPDIR)/$*.d -c $< -o $@ $(LIBS)
.PHONY: run
run: $(DIST)/$(OUT)
./$^ $(ARGS)
.PHONY:
clean:
rm -rfv $(DIST)/*
$(DIST):
mkdir -p $(DIST)
$(DEPDIR):
mkdir -p $(DEPDIR)
-include $(DEPS)

10
build.sh Normal file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env sh
set -xe
GFLAGS="-Wall -Wextra -Wswitch-enum -std=c++17"
DFLAGS="-ggdb -fsanitize=address -fsanitize=undefined"
CFLAGS="$GFLAGS $DFLAGS"
LIBS="-lraylib -lm"
c++ $CFLAGS -o cw_tree.out src/numerics.cpp src/main.cpp $LIBS

View File

@@ -1,17 +1,8 @@
/* Copyright (C) 2024 Aryadev Chavali
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License Version 2 for
* details.
* You may distribute and modify this code under the terms of the GNU General
* Public License Version 2, which you should have received a copy of along with
* this program. If not, please go to <https://www.gnu.org/licenses/>.
* Created: 2024-07-25
/* main.cpp: Entrypoint
* Created: 2025-11-20
* Author: Aryadev Chavali
* Description: Entrypoint
* License: See end of file
* Commentary: 2024-07-25
*/
#include "./numerics.hpp"
@@ -218,3 +209,16 @@ int main(void)
CloseWindow();
return 0;
}
/* Copyright (C) 2024, 2025 Aryadev Chavali
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License Version 2 for
* details.
* You may distribute and modify this code under the terms of the GNU General
* Public License Version 2, which you should have received a copy of along with
* this program. If not, please go to <https://www.gnu.org/licenses/>.
*/

View File

@@ -1,17 +1,8 @@
/* Copyright (C) 2024 Aryadev Chavali
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License Version 2 for
* details.
* You may distribute and modify this code under the terms of the GNU General
* Public License Version 2, which you should have received a copy of along with
* this program. If not, please go to <https://www.gnu.org/licenses/>.
/* numerics.cpp: Implementation of numerics
* Created: 2024-07-26
* Author: Aryadev Chavali
* Description: Implementation of numerics
* License: See end of file
* Commentary:
*/
#include "./numerics.hpp"
@@ -147,3 +138,16 @@ std::string to_string(const NodeAllocator &allocator, const index_t n,
ss << ")";
return ss.str();
}
/* Copyright (C) 2024, 2025 Aryadev Chavali
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License Version 2 for
* details.
* You may distribute and modify this code under the terms of the GNU General
* Public License Version 2, which you should have received a copy of along with
* this program. If not, please go to <https://www.gnu.org/licenses/>.
*/

View File

@@ -1,17 +1,8 @@
/* Copyright (C) 2024 Aryadev Chavali
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License Version 2 for
* details.
* You may distribute and modify this code under the terms of the GNU General
* Public License Version 2, which you should have received a copy of along with
* this program. If not, please go to <https://www.gnu.org/licenses/>.
/* numerics.hpp: Computation necessary for generating the tree
* Created: 2024-07-26
* Author: Aryadev Chavali
* Description: Computation necessary for generating the tree
* License: See end of file
* Commentary:
*/
#ifndef NUMERICS_HPP
@@ -67,3 +58,15 @@ std::string to_string(const Fraction &);
std::string to_string(const NodeAllocator &, const index_t, int depth = 1);
#endif
/* Copyright (C) 2024, 2025 Aryadev Chavali
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License Version 2 for
* details.
* You may distribute and modify this code under the terms of the GNU General
* Public License Version 2, which you should have received a copy of along with
* this program. If not, please go to <https://www.gnu.org/licenses/>.
*/