summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-12-31 09:53:33 -0800
committerMichael Pavone <pavone@retrodev.com>2017-12-31 09:53:33 -0800
commitf34bb0f36e058fc744546a33ed41c08c4954feca (patch)
tree0df23a0be0cc4f3f2c74ecd340d883927c26553d
parent15b6f9038a33cdab77f7fe380d6f41fd284fd9c5 (diff)
Enable LTO on certain targets that don't need the full LDFLAGS by splitting out the optimization flags into a separate var
-rw-r--r--Makefile20
1 files changed, 10 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index b44fb88..4350168 100644
--- a/Makefile
+++ b/Makefile
@@ -65,18 +65,18 @@ endif #PORTABLE
endif #Windows
ifdef DEBUG
-CFLAGS:=-ggdb $(CFLAGS)
-LDFLAGS:=-ggdb $(LDFLAGS)
+OPT:=-ggdb -Og
else
ifdef NOLTO
-CFLAGS:=-O2 $(CFLAGS)
-LDFLAGS:=-O2 $(LDFLAGS)
+OPT:=-O2
else
-CFLAGS:=-O2 -flto $(CFLAGS)
-LDFLAGS:=-O2 -flto $(LDFLAGS)
+OPT:=-O2 -flto
endif #NOLTO
endif #DEBUG
+CFLAGS:=$(OPT) $(CFLAGS)
+LDFLAGS:=$(OPT) $(LDFLAGS)
+
ifdef Z80_LOG_ADDRESS
CFLAGS+= -DZ80_LOG_ADDRESS
endif
@@ -166,7 +166,7 @@ blastjag$(EXE) : jaguar.o jag_video.o render_sdl.o serialize.o $(M68KOBJS) $(TRA
$(CC) -o $@ $^ $(LDFLAGS)
dis$(EXE) : dis.o 68kinst.o tern.o vos_program_module.o
- $(CC) -o $@ $^
+ $(CC) -o $@ $^ $(OPT)
jagdis : jagdis.o jagcpu.o tern.o
$(CC) -o $@ $^
@@ -178,13 +178,13 @@ libemu68k.a : $(M68KOBJS) $(TRANSOBJS)
ar rcs libemu68k.a $(M68KOBJS) $(TRANSOBJS)
trans : trans.o serialize.o $(M68KOBJS) $(TRANSOBJS) util.o
- $(CC) -o trans trans.o $(M68KOBJS) $(TRANSOBJS) util.o
+ $(CC) -o trans trans.o $(M68KOBJS) $(TRANSOBJS) util.o $(OPT)
transz80 : transz80.o $(Z80OBJS) $(TRANSOBJS)
$(CC) -o transz80 transz80.o $(Z80OBJS) $(TRANSOBJS)
ztestrun : ztestrun.o serialize.o $(Z80OBJS) $(TRANSOBJS)
- $(CC) -o ztestrun ztestrun.o $(Z80OBJS) $(TRANSOBJS)
+ $(CC) -o ztestrun ztestrun.o $(Z80OBJS) $(TRANSOBJS) $(OPT)
ztestgen : ztestgen.o z80inst.o
$(CC) -ggdb -o ztestgen ztestgen.o z80inst.o
@@ -198,7 +198,7 @@ vgmplay$(EXE) : vgmplay.o render_sdl.o ppm.o serialize.o $(CONFIGOBJS) $(AUDIOOB
$(FIXUP) ./$@
blastcpm : blastcpm.o util.o serialize.o $(Z80OBJS) $(TRANSOBJS)
- $(CC) -o $@ $^
+ $(CC) -o $@ $^ $(OPT)
test : test.o vdp.o
$(CC) -o test test.o vdp.o