fix building on linux

master
Alex Baines 2016-11-06 02:31:45 +00:00
parent 2ec3b7348b
commit a56edef9db
4 changed files with 86 additions and 8 deletions

View File

@ -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:

70
Makefile.inso Normal file
View File

@ -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

View File

@ -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"
@ -825,17 +828,18 @@ do_buildsuper(char *cdir){
//copy_sc(&str, "../code/internal_4coder_tests.cpp");
//terminate_with_null(&str);
//buildsuper(cdir, BUILD_DIR, str.str);
#else
copy_sc(&str, "../code/power/4coder_experiments.cpp");
terminate_with_null(&str);
buildsuper(cdir, BUILD_DIR, str.str);
#endif
copy_sc(&str, "../code/power/4coder_casey.cpp");
terminate_with_null(&str);
buildsuper(cdir, BUILD_DIR, str.str);
//copy_sc(&str, "../4vim/4coder_chronal.cpp");
//terminate_with_null(&str);
//buildsuper(cdir, BUILD_DIR, str.str);
#else
copy_sc(&str, "../code/power/4coder_experiments.cpp");
terminate_with_null(&str);
buildsuper(cdir, BUILD_DIR, str.str);
#endif
END_TIME_SECTION("build custom");
}

View File

@ -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);