mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
Make Makefile's test programs safe(r)
We don't use -W or similarly strict compiler checks (yet), but enabling its use is a good thing. if you add -W to the cflags without this patch, detection of the compiler will fail with gcc 4.4 for example, because compiling of the test program will fail due to a warning of unused arguments and -Werror. similarly the other checks involving compiling test programs would fail. Corresponding to flashrom svn r1356. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
parent
d5b2228e43
commit
b23df71149
10
Makefile
10
Makefile
@ -413,7 +413,7 @@ strip: $(PROGRAM)$(EXEC_SUFFIX)
|
|||||||
compiler: featuresavailable
|
compiler: featuresavailable
|
||||||
@printf "Checking for a C compiler... "
|
@printf "Checking for a C compiler... "
|
||||||
@$(shell ( echo "int main(int argc, char **argv)"; \
|
@$(shell ( echo "int main(int argc, char **argv)"; \
|
||||||
echo "{ return 0; }"; ) > .test.c )
|
echo "{ (void) argc; (void) argv; return 0; }"; ) > .test.c )
|
||||||
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test.c -o .test$(EXEC_SUFFIX) >/dev/null && \
|
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test.c -o .test$(EXEC_SUFFIX) >/dev/null && \
|
||||||
echo "found." || ( echo "not found."; \
|
echo "found." || ( echo "not found."; \
|
||||||
rm -f .test.c .test$(EXEC_SUFFIX); exit 1)
|
rm -f .test.c .test$(EXEC_SUFFIX); exit 1)
|
||||||
@ -427,7 +427,7 @@ pciutils: compiler
|
|||||||
echo "#include <pci/pci.h>"; \
|
echo "#include <pci/pci.h>"; \
|
||||||
echo "struct pci_access *pacc;"; \
|
echo "struct pci_access *pacc;"; \
|
||||||
echo "int main(int argc, char **argv)"; \
|
echo "int main(int argc, char **argv)"; \
|
||||||
echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c )
|
echo "{ (void) argc; (void) argv; pacc = pci_alloc(); return 0; }"; ) > .test.c )
|
||||||
@$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >/dev/null 2>&1 && \
|
@$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >/dev/null 2>&1 && \
|
||||||
echo "found." || ( echo "not found."; echo; \
|
echo "found." || ( echo "not found."; echo; \
|
||||||
echo "Please install libpci headers (package pciutils-devel)."; \
|
echo "Please install libpci headers (package pciutils-devel)."; \
|
||||||
@ -469,7 +469,7 @@ features: compiler
|
|||||||
@$(shell ( echo "#include <ftdi.h>"; \
|
@$(shell ( echo "#include <ftdi.h>"; \
|
||||||
echo "struct ftdi_context *ftdic = NULL;"; \
|
echo "struct ftdi_context *ftdic = NULL;"; \
|
||||||
echo "int main(int argc, char **argv)"; \
|
echo "int main(int argc, char **argv)"; \
|
||||||
echo "{ return ftdi_init(ftdic); }"; ) > .featuretest.c )
|
echo "{ (void) argc; (void) argv; return ftdi_init(ftdic); }"; ) > .featuretest.c )
|
||||||
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(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 "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \
|
||||||
( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp )
|
( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp )
|
||||||
@ -477,7 +477,7 @@ features: compiler
|
|||||||
@$(shell ( echo "#include <sys/utsname.h>"; \
|
@$(shell ( echo "#include <sys/utsname.h>"; \
|
||||||
echo "struct utsname osinfo;"; \
|
echo "struct utsname osinfo;"; \
|
||||||
echo "int main(int argc, char **argv)"; \
|
echo "int main(int argc, char **argv)"; \
|
||||||
echo "{ uname (&osinfo); return 0; }"; ) > .featuretest.c )
|
echo "{ (void) argc; (void) argv; uname (&osinfo); return 0; }"; ) > .featuretest.c )
|
||||||
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/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 "found."; echo "UTSNAME := yes" >> .features.tmp ) || \
|
||||||
( echo "not found."; echo "UTSNAME := no" >> .features.tmp )
|
( echo "not found."; echo "UTSNAME := no" >> .features.tmp )
|
||||||
@ -490,7 +490,7 @@ features: compiler
|
|||||||
@$(shell ( echo "#include <sys/utsname.h>"; \
|
@$(shell ( echo "#include <sys/utsname.h>"; \
|
||||||
echo "struct utsname osinfo;"; \
|
echo "struct utsname osinfo;"; \
|
||||||
echo "int main(int argc, char **argv)"; \
|
echo "int main(int argc, char **argv)"; \
|
||||||
echo "{ uname (&osinfo); return 0; }"; ) > .featuretest.c )
|
echo "{ (void) argc; (void) argv; uname (&osinfo); return 0; }"; ) > .featuretest.c )
|
||||||
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/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 "found."; echo "UTSNAME := yes" >> .features.tmp ) || \
|
||||||
( echo "not found."; echo "UTSNAME := no" >> .features.tmp )
|
( echo "not found."; echo "UTSNAME := no" >> .features.tmp )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user