From 75f5ac7977f89ad796e48867d2413ccbbdf6f363 Mon Sep 17 00:00:00 2001 From: Alcaro Date: Fri, 6 Apr 2018 00:29:30 +0200 Subject: [PATCH] Various fixes, per #7 --- Makefile | 12 +++++++++--- make.sh | 8 ++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 5ec5661..eb5fcd2 100644 --- a/Makefile +++ b/Makefile @@ -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$@ diff --git a/make.sh b/make.sh index 0980526..cfe6729 100755 --- a/make.sh +++ b/make.sh @@ -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