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:
+3
-1
@@ -1,2 +1,4 @@
|
|||||||
build
|
build/gba
|
||||||
|
build/debug
|
||||||
|
build/release
|
||||||
tags
|
tags
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ if(NOT MSVC)
|
|||||||
-fno-rtti
|
-fno-rtti
|
||||||
-Wsign-compare
|
-Wsign-compare
|
||||||
-Wunused-variable
|
-Wunused-variable
|
||||||
#-Werror
|
-Werror
|
||||||
#--analyze
|
#--analyze
|
||||||
#-Os # GCC size optimization flag
|
#-Os # GCC size optimization flag
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -179,12 +179,13 @@ int write(int argc, char **args) {
|
|||||||
if (fsFile) {
|
if (fsFile) {
|
||||||
fseek(fsFile, 0, SEEK_END);
|
fseek(fsFile, 0, SEEK_END);
|
||||||
|
|
||||||
const auto fsSize = (::size_t) ftell(fsFile);
|
const auto fsSize = (size_t) ftell(fsFile);
|
||||||
rewind(fsFile);
|
rewind(fsFile);
|
||||||
auto fsBuff = (char*) malloc(fsSize);
|
auto fsBuff = (char*) malloc(fsSize);
|
||||||
fread(fsBuff, fsSize, 1, fsFile);
|
auto itemsRead = fread(fsBuff, fsSize, 1, fsFile);
|
||||||
fclose(fsFile);
|
fclose(fsFile);
|
||||||
|
|
||||||
|
if (itemsRead) {
|
||||||
auto srcBuff = loadFileBuff(srcPath, &srcSize);
|
auto srcBuff = loadFileBuff(srcPath, &srcSize);
|
||||||
if (srcBuff) {
|
if (srcBuff) {
|
||||||
auto fs = createFileSystem(fsBuff);
|
auto fs = createFileSystem(fsBuff);
|
||||||
@@ -215,6 +216,7 @@ int write(int argc, char **args) {
|
|||||||
err = 1;
|
err = 1;
|
||||||
fprintf(stderr, "Could not load source file.\n");
|
fprintf(stderr, "Could not load source file.\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(fsBuff);
|
free(fsBuff);
|
||||||
free(srcBuff);
|
free(srcBuff);
|
||||||
|
|||||||
Reference in New Issue
Block a user