ref: 3cacaf85f1ba66e08a8a3aeb6385b967236f9f66
parent: de935a52371fc7913cfe26e0ac07fef67e93c876
author: Martin Storsjö <martin@martin.st>
date: Thu Jan 23 11:14:09 EST 2014
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.)
--- a/build/mktargets.py
+++ b/build/mktargets.py
@@ -110,9 +110,9 @@
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()
--- a/build/platform-mingw_nt.mk
+++ b/build/platform-mingw_nt.mk
@@ -11,4 +11,5 @@
ASMFLAGS += -f win32 -DPREFIX
CFLAGS += -DWIN32
endif
+EXEEXT = .exe
--- a/build/platform-msvc-common.mk
+++ b/build/platform-msvc-common.mk
@@ -11,3 +11,4 @@
LINK_LIB=$(1).lib
LIBSUFFIX=lib
LIBPREFIX=
+EXEEXT=.exe
--- a/codec/console/dec/targets.mk
+++ b/codec/console/dec/targets.mk
@@ -10,8 +10,8 @@
$(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)
--- a/codec/console/enc/targets.mk
+++ b/codec/console/enc/targets.mk
@@ -9,8 +9,8 @@
$(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)
--- a/test/targets.mk
+++ b/test/targets.mk
@@ -10,8 +10,8 @@
$(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)