Handle OS where executables have a hardcoded suffix, e.g. DOS with .exe .
This ensures that any temp files in the configure/check step of the
Makefile are removed correctly.

Signed-off-by: Carl-Daniel Hailfinger <[email protected]>

Index: flashrom-dos_exec_suffix/Makefile
===================================================================
--- flashrom-dos_exec_suffix/Makefile   (Revision 1045)
+++ flashrom-dos_exec_suffix/Makefile   (Arbeitskopie)
@@ -49,6 +49,7 @@
 LDFLAGS += -L/usr/local/lib
 endif
 ifeq ($(OS_ARCH), DOS)
+EXEC_SUFFIX := .exe
 CPPFLAGS += -I../libgetopt -I../libpci/include
 # FIXME Check if we can achieve the same effect with -L../libgetopt -lgetopt
 LIBS += ../libgetopt/libgetopt.a
@@ -256,7 +257,7 @@
 OBJS = $(CHIP_OBJS) $(CLI_OBJS) $(PROGRAMMER_OBJS) $(LIB_OBJS)
 
 $(PROGRAM): $(OBJS)
-       $(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(FEATURE_LIBS) $(LIBS)
+       $(CC) $(LDFLAGS) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJS) $(FEATURE_LIBS) 
$(LIBS)
 
 # TAROPTIONS reduces information leakage from the packager's system.
 # If other tar programs support command line arguments for setting uid/gid of
@@ -281,10 +282,10 @@
        @printf "Checking for a C compiler... "
        @$(shell ( echo "int main(int argc, char **argv)"; \
                   echo "{ return 0; }"; ) > .test.c )
-       @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test.c -o .test >/dev/null &&  
\
+       @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test.c -o .test$(EXEC_SUFFIX) 
>/dev/null &&    \
                echo "found." || ( echo "not found."; \
-               rm -f .test.c .test; exit 1)
-       @rm -f .test.c .test
+               rm -f .test.c .test$(EXEC_SUFFIX); exit 1)
+       @rm -f .test.c .test$(EXEC_SUFFIX)
 
 ifeq ($(CHECK_LIBPCI), yes)
 pciutils: compiler
@@ -300,15 +301,15 @@
                rm -f .test.c .test.o; exit 1)
        @printf "Checking if libpci is present and sufficient... "
        @printf "" > .libdeps
-       @$(CC) $(LDFLAGS) .test.o -o .test $(LIBS) >/dev/null 2>&1 &&           
                \
+       @$(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) >/dev/null 
2>&1 &&                             \
                echo "yes." || ( echo "no.";                                    
                \
                printf "Checking if libz+libpci are present and sufficient..."; 
\
-               $(CC) $(LDFLAGS) .test.o -o .test $(LIBS) -lz >/dev/null 2>&1 
&&                \
+               $(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) -lz 
>/dev/null 2>&1 &&          \
                ( echo "yes."; echo "NEEDLIBZ := yes" > .libdeps ) || ( echo 
"no."; echo;       \
                echo "Please install libpci (package pciutils) and/or libz.";   
                \
                echo "See README for more information."; echo;                  
        \
-               rm -f .test.c .test.o .test; exit 1) )
-       @rm -f .test.c .test.o .test
+               rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1) )
+       @rm -f .test.c .test.o .test$(EXEC_SUFFIX)
 else
 pciutils: compiler
        @printf "" > .libdeps
@@ -324,7 +325,7 @@
                   echo "struct ftdi_context *ftdic = NULL;";      \
                   echo "int main(int argc, char **argv)"; \
                   echo "{ return ftdi_init(ftdic); }"; ) > .featuretest.c )
-       @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest 
$(FTDILIBS) $(LIBS) >/dev/null 2>&1 &&   \
+       @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o 
.featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >/dev/null 2>&1 &&     \
                ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) 
||        \
                ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp )
        @printf "Checking for utsname support... "
@@ -332,11 +333,11 @@
                   echo "struct utsname osinfo;";          \
                   echo "int main(int argc, char **argv)"; \
                   echo "{ uname (&osinfo); return 0; }"; ) > .featuretest.c )
-       @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest 
>/dev/null 2>&1 &&       \
+       @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o 
.featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \
                ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) ||    
\
                ( echo "not found."; echo "UTSNAME := no" >> .features.tmp )
        @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp 
|| mv .features.tmp .features
-       @rm -f .featuretest.c .featuretest
+       @rm -f .featuretest.c .featuretest$(EXEC_SUFFIX)
 else
 features: compiler
        @echo "FEATURES := yes" > .features.tmp
@@ -345,11 +346,11 @@
                   echo "struct utsname osinfo;";          \
                   echo "int main(int argc, char **argv)"; \
                   echo "{ uname (&osinfo); return 0; }"; ) > .featuretest.c )
-       @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest 
>/dev/null 2>&1 &&       \
+       @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o 
.featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \
                ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) ||    
\
                ( echo "not found."; echo "UTSNAME := no" >> .features.tmp )
        @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp 
|| mv .features.tmp .features
-       @rm -f .featuretest.c .featuretest
+       @rm -f .featuretest.c .featuretest$(EXEC_SUFFIX)
 endif
 
 install: $(PROGRAM)


-- 
http://www.hailfinger.org/


_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to