diff --git a/.gitignore b/.gitignore index be7f4c6..00e0ff7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tbuild +main.o diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..33b1ed3 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +CC=tcc +CFLAGS=-O0 -ggdb -Wall + +.PHONY: all clean install + +all: tbuild + +tbuild: main.o tomlc99/toml.o + $(CC) $(CFLAGS) tomlc99/toml.o main.o -o tbuild + +main.o: main.c + $(CC) $(CFLAGS) -c main.c -o main.o + +tomlc99/toml.o: + cd tomlc99 && $(MAKE) && cd .. + +clean: + rm -f tbuild main.o tomlc99/toml.o + +install: +ifeq ($(OS),Windows_NT) + mkdir "C:\tbuild" ; \ + copy tbuild "C:\tbuild" ; \ + copy RedSeaGen.exe "C:\tbuild" ; +else + install tbuild /usr/local/bin + install RedSeaGen /usr/local/bin +endif + diff --git a/README.md b/README.md index 23b5778..07bf6b0 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,7 @@ conversion for ZealOS and dependency management. ## Building and installing -To build and install, simply run `./build.sh`. After it has finished compiling, -you can put the built `tbuild` binary anywhere in your PATH. Make sure you also -put in the same directory the corresponding RedSeaGen binary for your system. +To build, simply run `make`. After it has finished compiling, you can run `make install` to install the resulting binary into your system. ## Usage diff --git a/build.sh b/build.sh deleted file mode 100755 index 75dc2c1..0000000 --- a/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -cd tomlc99 -make -cd .. -cc tomlc99/toml.o main.c -o tbuild -O0 -ggdb diff --git a/main.c b/main.c index 3b7366f..0036a43 100644 --- a/main.c +++ b/main.c @@ -874,11 +874,11 @@ Del(\"C:/Apps/Wordle/RunCD.*\");\n\ char *iso_c = malloc((strlen(buffer_text_format)+1)*sizeof(char)); strcpy(iso_c, buffer_text_format); #if defined(_WIN32) - system(text_format("%s/RedSeaGen.exe '%s' '%s'", abs_exe_path, build_dir, iso_c)); + system(text_format("RedSeaGen.exe '%s' '%s'", build_dir, iso_c)); #else - system(text_format("%s/RedSeaGen '%s' '%s'", abs_exe_path, build_dir, iso_c)); + system(text_format("RedSeaGen '%s' '%s'", build_dir, iso_c)); #endif - +//abs_exe_path, free(build_dir); free(out_dir); free(scripts_dir);