diff --git a/Makefile b/Makefile index 980e9ff..27e1770 100644 --- a/Makefile +++ b/Makefile @@ -25,13 +25,13 @@ MRUBY_CFLAGS ?= -I./libs/mruby/build/host/include MRUBY_LIBS ?= -L./libs/mruby/build/host/lib -lmruby CFLAGS_DEBUG :=\ - -std=c++26 -Wall -Wextra \ - -O0 -fno-inline -gsplit-dwarf \ + -std=c++20 -Wall -Wextra -fno-rtti \ + -Og -fno-inline -gsplit-dwarf \ -g -fno-omit-frame-pointer -ffast-math \ -I./include -I./libs/unicode_width CFLAGS_RELEASE :=\ - -std=c++26 -O3 -march=x86-64 -mtune=generic -fno-rtti \ + -std=c++20 -O3 -mtune=generic -fno-rtti \ -fvisibility=hidden -static -ffast-math \ -fomit-frame-pointer -DNDEBUG -s \ -I./include -I./libs/unicode_width @@ -77,6 +77,7 @@ $(TARGET_DEBUG): $(PCH_DEBUG) $(OBJ_DEBUG) $(UNICODE_OBJ) $(TARGET_RELEASE): $(PCH_RELEASE) $(OBJ_RELEASE) $(UNICODE_OBJ) @mkdir -p $(BIN_DIR) @$(CXX) $(CFLAGS_RELEASE) -o $@ $(OBJ_RELEASE) $(UNICODE_OBJ) $(LIBS) + @strip $@ @echo "Release build complete: $@" $(OBJ_DIR)/debug/%.o: $(SRC_DIR)/%.cc $(PCH_DEBUG) $(GENERATED_HEADER) diff --git a/flake.nix b/flake.nix index 98a955a..502e229 100644 --- a/flake.nix +++ b/flake.nix @@ -59,6 +59,7 @@ xxd bash findutils + binutils ]; buildInputs = with pkgs; [ diff --git a/include/pch.h b/include/pch.h index 6d3f2b1..ced4c6c 100644 --- a/include/pch.h +++ b/include/pch.h @@ -29,7 +29,6 @@ extern "C" { #include #include #include -#include #include #include #include @@ -51,4 +50,5 @@ extern "C" { #include #include #include +#include #include diff --git a/src/main.cc b/src/main.cc index 2cee90b..59c2721 100644 --- a/src/main.cc +++ b/src/main.cc @@ -3,15 +3,26 @@ #include "vase/shard.h" #include "vase/vase.h" -int main() { - const char *text_o = +int main(int argc, char *argv[]) { + /*const char *text_o = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n" "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n" "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n" "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"; uint32_t len = strlen(text_o); - char *text = strdup(text_o); + char *text = strdup(text_o);*/ + + const char *path; + + if (argc >= 2) + path = argv[1]; + else + throw "Please give filename."; + + uint32_t len; + char *text; + read_file(path, &text, &len); Vase vase = Vase(text, len);