From cb3b8582dfe5c58f50126c16818da0e12e762ccd Mon Sep 17 00:00:00 2001 From: Narayan Bandodker Date: Sun, 19 Apr 2026 21:30:31 +0530 Subject: [PATCH] Updated readme, removed Makefile --- Makefile | 35 ----------------------------------- README.md | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 39 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index b914ac2..0000000 --- a/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -#Program path configuration -OUTDIR := bin -SRCDIR := src -INCDIR := include -OBJDIR := obj -OUTBIN := $(OUTDIR)/server - -#Compiler path configuration -CC := gcc - -#Compiler flags -includes = -I$(INCDIR) -I$(SRCDIR) -flags = $(includes) -cflags = $(flags) -O3 -lflags = $(flags) - -#Files to compile from/to -c_files = $(wildcard $(SRCDIR)/*.c) - -#Target object files to link -o_files = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(notdir $(c_files)))) - -#Main target, the output executable -$(OUTBIN): $(o_files) - $(CC) $(lflags) $^ -o $@ - -#Look into src folder for .c files to make corresponding .o files -$(OBJDIR)/%.o: $(SRCDIR)/%.c - $(CC) $(cflags) -c $< -o $@ - -all: $(OUTBIN) -default: all -clean: - rm -f $(OUTBIN) - rm -f $(OBJDIR)/*.o \ No newline at end of file diff --git a/README.md b/README.md index 3d09c96..9040c18 100644 --- a/README.md +++ b/README.md @@ -30,15 +30,46 @@ The interpreter traverses the AST in breadth-first order, calling functions on i ## Building -This code is made to build on a Unix-compatible machine (sorry Windows users). Just call `make` and it will output the server binary in `bin/server`. There are no other dependencies. +This code is mostly cross-platform. The Basic interactive shell is cross-platform, but the server target is currently only buildable on Unix-like systems. -But before that, you need to have the two folders, `bin` and `obj` present in the project directory, if not present. +CMake is required to build this project. No other external libraries are needed. + +### Steps to build + +1. Create a "build" directory to store all the build artifacts, and cd into the directory. + +```shell +mkdir build +cd build/ +``` + +2. Configure the project + +```shell +cmake .. +``` + +3. Build the whole project + +```shell +cmake --build . +``` ## Running -From the repository folder, run `bin/server`. Don't run it from the bin directory, as it requires the *static* folder to be present in the pwd (You can just move one or the other so that those two are in the same directory). +### Interactive shell + +You can run the interactive shell, which is the `BasicIO` target as: + +```shell +build/BasicIO +``` + +### Server + +From the repository folder, run `build/server`. Don't run it from the build directory, as it requires the *static* folder to be present in the pwd (You can just move one or the other so that those two are in the same directory). -This will start an HTTP server on port `1111` (You can change this by changing `LISTEN_PORT` constant in `main.c`) +This will start an HTTP server on port `1111` (You can change this by changing `LISTEN_PORT` constant in `http_server_main.c`) Start a browser and head over to [http://localhost:1111/](http://localhost:1111/). It will present to you a sort-of IDE where you can type in code and execute it.