Add a master Makefile with docker dev env support and address compiler warning that showed up in the Docker dev env

This commit is contained in:
2016-12-22 20:57:57 -06:00
parent 02bbd75606
commit eeff110b31
5 changed files with 93 additions and 27 deletions
+3 -1
View File
@@ -1,2 +1,4 @@
build
build/gba
build/debug
build/release
tags
+1 -1
View File
@@ -16,7 +16,7 @@ if(NOT MSVC)
-fno-rtti
-Wsign-compare
-Wunused-variable
#-Werror
-Werror
#--analyze
#-Os # GCC size optimization flag
)
+46
View File
@@ -0,0 +1,46 @@
DEVENV=devenv$(shell pwd | sed 's/\//-/g')
ifeq ($(shell docker inspect --format="{{.State.Status}}" ${DEVENV} 2>&1),running)
ENV_RUN=docker exec --user $(shell id -u ${USER}) ${DEVENV}
endif
make:
${ENV_RUN} make -j -C build
preinstall:
${ENV_RUN} make -j -C build ARGS="preinstall"
install:
${ENV_RUN} make -j -C build ARGS="install"
clean:
${ENV_RUN} make -j -C build ARGS="clean"
purge:
${ENV_RUN} rm -rf $(find build -mindepth 1 -maxdepth 1 -type d)
test:
${ENV_RUN} make -j -C build ARGS="test"
run: make
./build/current/src/wombat/wombat -debug
debug: make
gdb ./build/current/src/wombat/wombat
devenv:
docker pull wombatant/devenv
docker run -d -v $(shell pwd):/usr/src/project \
-e LOCAL_USER_ID=$(shell id -u ${USER}) \
--name ${DEVENV} -t wombatant/devenv bash
devenv-destroy:
docker rm -f ${DEVENV}
native:
${ENV_RUN} rm -rf build/release
${ENV_RUN} ./scripts/setup_build
${ENV_RUN} rm -f build/current
${ENV_RUN} ln -s release build/current
native_debug:
${ENV_RUN} rm -rf build/debug
${ENV_RUN} ./scripts/setup_build_debug
${ENV_RUN} rm -f build/current
${ENV_RUN} ln -s debug build/current
gba:
${ENV_RUN} rm -rf build/gba
${ENV_RUN} ./scripts/setup_build_gba
${ENV_RUN} rm -f build/current
${ENV_RUN} ln -s gba build/current
+16
View File
@@ -0,0 +1,16 @@
all: gba_build native_build native_debug_build
gba_build:
@if [ -d gba ]; then \
make -C gba ${ARGS}; \
fi
native_build:
@if [ -d release ]; then \
make -C release ${ARGS}; \
fi
native_debug_build:
@if [ -d debug ]; then \
make -C debug ${ARGS}; \
fi
+4 -2
View File
@@ -179,12 +179,13 @@ int write(int argc, char **args) {
if (fsFile) {
fseek(fsFile, 0, SEEK_END);
const auto fsSize = (::size_t) ftell(fsFile);
const auto fsSize = (size_t) ftell(fsFile);
rewind(fsFile);
auto fsBuff = (char*) malloc(fsSize);
fread(fsBuff, fsSize, 1, fsFile);
auto itemsRead = fread(fsBuff, fsSize, 1, fsFile);
fclose(fsFile);
if (itemsRead) {
auto srcBuff = loadFileBuff(srcPath, &srcSize);
if (srcBuff) {
auto fs = createFileSystem(fsBuff);
@@ -215,6 +216,7 @@ int write(int argc, char **args) {
err = 1;
fprintf(stderr, "Could not load source file.\n");
}
}
free(fsBuff);
free(srcBuff);