diff --git a/Makefile b/Makefile index 199c7700..80794482 100755 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ C_FILES := $(wildcard *.c) $(wildcard **/*.c) H_FILES := $(wildcard *.h) $(wildcard **/*.h) WARNINGS := -Wno-write-strings -FLAGS := -D_GNU_SOURCE -fPIC +FLAGS := -D_GNU_SOURCE -fPIC -fpermissive debug: FLAGS += -DDEV_BUILD debug: ../build/build @@ -12,7 +12,7 @@ package: FLAGS += -DPACKAGE package: ../build/build ../build/build: $(CPP_FILES) $(C_FILES) $(H_FILES) - gcc $(WARNINGS) $(FLAGS) build.c -g -o $@ + g++ $(WARNINGS) $(FLAGS) build.cpp -g -o $@ ../build/build clean: diff --git a/Makefile.inso b/Makefile.inso new file mode 100644 index 00000000..9096786e --- /dev/null +++ b/Makefile.inso @@ -0,0 +1,70 @@ +FLAGS := -Wno-write-strings -D_GNU_SOURCE -fno-threadsafe-statics \ + -pthread -I../foreign -I. -Wno-literal-suffix +LIBS := -lX11 -lXfixes -lGL -lrt -ldl -lm -lfreetype -lfontconfig + +# main targets + +debug: FLAGS += -DFRED_SUPER=1 -DFRED_INTERNAL=1 -O0 -g +debug: ../4ed ../4ed_app.so ../4coder_custom.so + +super: FLAGS += -DFRED_SUPER=1 +super: alpha ../4coder_custom.so + +alpha: FLAGS += -O3 -Wl,-s -fno-stack-protector -U_FORTIFY_SOURCE -DFRED_KEEP_ASSERT=1 +alpha: ../4ed ../4ed_app.so + +# auto-generated dependencies + +-include ../build/*.d + +# file targets + +../build: + mkdir $@ + +../build/fsmgen: fsm_table_generator.cpp | ../build + $(CXX) -MMD $(FLAGS) $< -o $@ + $@ + +../build/metagen: 4ed_metagen.cpp | ../build + $(CXX) -MMD $(FLAGS) $< -o $@ + $@ + +../4ed: linux_4ed.cpp ../build/fsmgen ../build/metagen + $(CXX) -MMD -MF ../build/4ed.d $(FLAGS) $(shell pkg-config --cflags freetype2) $< -o $@ $(LIBS) + +../4ed_app.so: 4ed_app_target.cpp ../build/fsmgen ../build/metagen + $(CXX) -MMD -MF ../build/app.d $(FLAGS) -fPIC -shared $< -o $@ + +../4coder_custom.so: power/4coder_experiments.cpp ../build/fsmgen ../build/metagen + $(CXX) -MMD -MF ../build/custom.d $(FLAGS) -I. -fPIC -shared $< -o $@ + +# cleaning + +clean: + $(RM) ../4ed_app.so ../4ed ../4coder_custom.so + +veryclean: clean + $(RM) ../build/fsmgen ../build/metagen ../build/*.d + +# packaging + +PACKAGE_FILES := ../4ed ../4ed_app.so README.txt TODO.txt +V_MAJ := $(shell grep "define MAJOR" 4coder_version.h | cut -d\ -f 3) +V_MIN := $(shell grep "define MINOR" 4coder_version.h | cut -d\ -f 3) +V_PCH := $(shell grep "define PATCH" 4coder_version.h | cut -d\ -f 3) + +super_zip: PACKAGE_FILES += ../4coder_custom.so 4coder_*.h 4coder_*.cpp buildsuper.sh +super_zip: ../4coder-linux-64-$(V_MAJ)-$(V_MIN)-$(V_PCH)-super.zip +alpha_zip: ../4coder-linux-64-$(V_MAJ)-$(V_MIN)-$(V_PCH)-alpha.zip + +../4coder-linux-64-$(V_MAJ)-$(V_MIN)-$(V_PCH)-%.zip: % + @echo === Creating $@ === + zip -j $@ $(PACKAGE_FILES) + $(MAKE) clean + +package: clean + $(MAKE) alpha_zip + $(MAKE) super_zip + +.PHONY: debug alpha super all clean veryclean package alpha_zip super_zip diff --git a/build.cpp b/build.cpp index 8f2c1d72..15a25a3d 100644 --- a/build.cpp +++ b/build.cpp @@ -557,10 +557,13 @@ build_cl(uint32_t flags, } +// NOTE(inso): added ../code to GCC_OPTS to allow metagen to build. +// this is currently needed because it is built with cwd ../meta but includes +// 4cpp_lexer.h which is in code/ whereas metagen.cpp is in code/site #define GCC_OPTS \ "-Wno-write-strings -D_GNU_SOURCE -fPIC " \ -"-fno-threadsafe-statics -pthread" +"-fno-threadsafe-statics -pthread -I../code" #define GCC_INCLUDES \ "-I../foreign" @@ -836,6 +839,7 @@ do_buildsuper(char *cdir){ //copy_sc(&str, "../4vim/4coder_chronal.cpp"); //terminate_with_null(&str); //buildsuper(cdir, BUILD_DIR, str.str); + END_TIME_SECTION("build custom"); } diff --git a/site/meta_parser.cpp b/site/meta_parser.cpp index 65badc77..1e21591d 100644 --- a/site/meta_parser.cpp +++ b/site/meta_parser.cpp @@ -1215,7 +1215,11 @@ compile_meta_unit(Partition *part, char *code_directory, char **files, Meta_Keyw char str_space[512]; String name = make_fixed_width_string(str_space); append_sc(&name, code_directory); +#ifdef _WIN32 append_sc(&name, "\\"); +#else + append_sc(&name, "/"); +#endif append_sc(&name, *file_ptr); terminate_with_null(&name);