Include the executable suffix within make

This makes sure that e.g. "make clean" actually removes
the built exe files, and avoids relinking the exe files each
time make is run when cross compiling from linux to windows.

(Make on windows seems to have an exception that knows to skip
rebuilding the 'h264enc' target if 'h264enc' doesn't exist but
'h264enc.exe' does, but this exception doesn't work on normal
unix make.)
This commit is contained in:
Martin Storsjö 2014-01-23 16:14:09 +02:00
parent de935a5237
commit 3cacaf85f1
6 changed files with 14 additions and 12 deletions

View File

@ -110,9 +110,9 @@ if args.library is not None:
f.write("LIBRARIES += $(LIBPREFIX)%s.$(LIBSUFFIX)\n"%args.library)
if args.binary is not None:
f.write("%s: $(%s_OBJS) $(LIBS) $(%s_LIBS) $(%s_DEPS)\n"%(args.binary, PREFIX, PREFIX, PREFIX))
f.write("%s$(EXEEXT): $(%s_OBJS) $(LIBS) $(%s_LIBS) $(%s_DEPS)\n"%(args.binary, PREFIX, PREFIX, PREFIX))
f.write("\t$(CXX) $(CXX_LINK_O) $(%s_OBJS) $(%s_LDFLAGS) $(%s_LIBS) $(LDFLAGS) $(LIBS)\n\n"%(PREFIX, PREFIX, PREFIX))
f.write("binaries: %s\n"%args.binary)
f.write("BINARIES += %s\n"%args.binary)
f.write("binaries: %s$(EXEEXT)\n"%args.binary)
f.write("BINARIES += %s$(EXEEXT)\n"%args.binary)
f.close()

View File

@ -11,4 +11,5 @@ else
ASMFLAGS += -f win32 -DPREFIX
CFLAGS += -DWIN32
endif
EXEEXT = .exe

View File

@ -11,3 +11,4 @@ CFLAGS_M64=
LINK_LIB=$(1).lib
LIBSUFFIX=lib
LIBPREFIX=
EXEEXT=.exe

View File

@ -10,8 +10,8 @@ OBJS += $(H264DEC_OBJS)
$(H264DEC_SRCDIR)/%.o: $(H264DEC_SRCDIR)/%.cpp
$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(H264DEC_CFLAGS) $(H264DEC_INCLUDES) -c $(CXX_O) $<
h264dec: $(H264DEC_OBJS) $(LIBS) $(H264DEC_LIBS) $(H264DEC_DEPS)
h264dec$(EXEEXT): $(H264DEC_OBJS) $(LIBS) $(H264DEC_LIBS) $(H264DEC_DEPS)
$(CXX) $(CXX_LINK_O) $(H264DEC_OBJS) $(H264DEC_LDFLAGS) $(H264DEC_LIBS) $(LDFLAGS) $(LIBS)
binaries: h264dec
BINARIES += h264dec
binaries: h264dec$(EXEEXT)
BINARIES += h264dec$(EXEEXT)

View File

@ -9,8 +9,8 @@ OBJS += $(H264ENC_OBJS)
$(H264ENC_SRCDIR)/%.o: $(H264ENC_SRCDIR)/%.cpp
$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(H264ENC_CFLAGS) $(H264ENC_INCLUDES) -c $(CXX_O) $<
h264enc: $(H264ENC_OBJS) $(LIBS) $(H264ENC_LIBS) $(H264ENC_DEPS)
h264enc$(EXEEXT): $(H264ENC_OBJS) $(LIBS) $(H264ENC_LIBS) $(H264ENC_DEPS)
$(CXX) $(CXX_LINK_O) $(H264ENC_OBJS) $(H264ENC_LDFLAGS) $(H264ENC_LIBS) $(LDFLAGS) $(LIBS)
binaries: h264enc
BINARIES += h264enc
binaries: h264enc$(EXEEXT)
BINARIES += h264enc$(EXEEXT)

View File

@ -10,8 +10,8 @@ OBJS += $(CODEC_UNITTEST_OBJS)
$(CODEC_UNITTEST_SRCDIR)/%.o: $(CODEC_UNITTEST_SRCDIR)/%.cpp
$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(CODEC_UNITTEST_CFLAGS) $(CODEC_UNITTEST_INCLUDES) -c $(CXX_O) $<
codec_unittest: $(CODEC_UNITTEST_OBJS) $(LIBS) $(CODEC_UNITTEST_LIBS) $(CODEC_UNITTEST_DEPS)
codec_unittest$(EXEEXT): $(CODEC_UNITTEST_OBJS) $(LIBS) $(CODEC_UNITTEST_LIBS) $(CODEC_UNITTEST_DEPS)
$(CXX) $(CXX_LINK_O) $(CODEC_UNITTEST_OBJS) $(CODEC_UNITTEST_LDFLAGS) $(CODEC_UNITTEST_LIBS) $(LDFLAGS) $(LIBS)
binaries: codec_unittest
BINARIES += codec_unittest
binaries: codec_unittest$(EXEEXT)
BINARIES += codec_unittest$(EXEEXT)