Various fixes, per #7

This commit is contained in:
Alcaro
2018-04-06 00:29:30 +02:00
parent edadbffc8f
commit 75f5ac7977
2 changed files with 15 additions and 5 deletions

View File

@@ -44,20 +44,26 @@ endif
ifeq ($(TARGET),gtk)
ifeq ($(GTKFLAGS),)
GTKFLAGS := $(shell pkg-config --cflags --libs gtk+-3.0 2>/dev/null)
GTKFLAGS := $(shell pkg-config --cflags --libs gtk+-3.0)
endif
ifeq ($(GTKFLAGS),)
$(warning pkg-config can't find gtk+-3.0, or pkg-config itself can't be found)
$(warning if you have the needed files installed, specify their locations and names with `make GTKFLAGS='-I/usr/include' GTKLIBS='-L/usr/lib -lgtk'')
$(warning if not, the package name under Debian and derivates is `libgtk-3-dev'; for other distros, consult a search engine)
$(warning switching to CLI build)
TARGET := cli
ifeq ($(TARGET),gtk)
$(warning build will now fail)
else
$(warning switching to CLI build)
endif
endif
endif
all: $(FNAME_$(TARGET))
obj:
mkdir obj
clean: | obj
rm obj/* || true
ifeq ($(TARGET),windows)
XFILES += obj/rc.o
@@ -90,4 +96,4 @@ ifeq ($(TARGET),gtk)
endif
$(FNAME_$(TARGET)): $(SOURCES) $(XFILES)
$(CXX) $^ -std=c++98 $(CFLAGS) $(LFLAGS) $(CFLAGS_G) $(MOREFLAGS) $(XFILES) -o$@
$(CXX) $^ -std=c++98 $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) $(LFLAGS) $(CFLAGS_G) $(MOREFLAGS) $(XFILES) -o$@

View File

@@ -3,7 +3,7 @@
#clean up
rm flips.exe floating.zip flips obj/*
FLAGS='-Wall -Werror -O3 -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden'
FLAGS='-Wall -Werror -O3 -s -flto -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden'
FLAGS+=' -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables'
FLAGS+=' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/'
@@ -32,6 +32,7 @@ FLAGS+=' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj
#[ -e flips ] || exit
#create linux binary
if [ -e profile/smw.smc ]; then
echo 'GTK+ (1/3)'
rm flips; make TARGET=gtk CFLAGS="$FLAGS -fprofile-generate" LFLAGS='-lgcov'
[ -e flips ] || exit
@@ -39,8 +40,11 @@ echo 'GTK+ (2/3)'
profile/profile.sh ./flips
echo 'GTK+ (3/3)'
rm flips; make TARGET=gtk CFLAGS="$FLAGS -fprofile-use" LFLAGS=''
rm *.gcda
#mv flips '~/bin/flips'
else
echo 'Warning: Missing ROMs for profiling, building without'
rm flips; make TARGET=gtk CFLAGS="$FLAGS"
fi
#echo Finishing
##compress source