- Timestamp:
- 08/18/11 04:27:19 (9 months ago)
- File:
-
- 1 edited
-
trunk/Makefile (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile
r1400 r1416 39 39 40 40 # Determine the destination processor architecture 41 override ARCH = $(strip $(shell LC_ALL=C $(CC) -E arch.h|grep -v '^\#'))41 override ARCH := $(strip $(shell LC_ALL=C $(CC) -E arch.h|grep -v '^\#')) 42 42 43 43 # FIXME We have to differentiate between host and target OS architecture. … … 532 532 $(STRIP) $(STRIP_ARGS) $(PROGRAM)$(EXEC_SUFFIX) 533 533 534 # to define test programs we use verbatim variables, which get exported 535 # to environment variables and are referenced with $$<varname> later 536 537 define COMPILER_TEST 538 int main(int argc, char **argv) 539 { 540 (void) argc; 541 (void) argv; 542 return 0; 543 } 544 endef 545 export COMPILER_TEST 546 534 547 compiler: featuresavailable 535 548 @printf "Checking for a C compiler... " 536 @$(shell ( echo "int main(int argc, char **argv)"; \ 537 echo "{ (void) argc; (void) argv; return 0; }"; ) > .test.c ) 538 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test.c -o .test$(EXEC_SUFFIX) >/dev/null && \ 549 @echo "$$COMPILER_TEST" > .test.c 550 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test.c -o .test$(EXEC_SUFFIX) >/dev/null 2>&1 && \ 539 551 echo "found." || ( echo "not found."; \ 540 552 rm -f .test.c .test$(EXEC_SUFFIX); exit 1) … … 546 558 @printf "%s\n" '$(ARCH)' 547 559 560 define LIBPCI_TEST 561 /* Avoid a failing test due to libpci header symbol shadowing breakage */ 562 #define index shadow_workaround_index 563 #include <pci/pci.h> 564 struct pci_access *pacc; 565 int main(int argc, char **argv) 566 { 567 (void) argc; 568 (void) argv; 569 pacc = pci_alloc(); 570 return 0; 571 } 572 endef 573 export LIBPCI_TEST 574 548 575 ifeq ($(CHECK_LIBPCI), yes) 549 576 pciutils: compiler 550 577 @printf "Checking for libpci headers... " 551 @# Avoid a failing test due to libpci header symbol shadowing breakage 552 @$(shell ( echo "#define index shadow_workaround_index"; \ 553 echo "#include <pci/pci.h>"; \ 554 echo "struct pci_access *pacc;"; \ 555 echo "int main(int argc, char **argv)"; \ 556 echo "{ (void) argc; (void) argv; pacc = pci_alloc(); return 0; }"; ) > .test.c ) 578 @echo "$$LIBPCI_TEST" > .test.c 557 579 @$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >/dev/null 2>&1 && \ 558 580 echo "found." || ( echo "not found."; echo; \ … … 589 611 endif 590 612 591 ifeq ($(CONFIG_FT2232_SPI), yes) 613 define FTDI_TEST 614 #include <ftdi.h> 615 struct ftdi_context *ftdic = NULL; 616 int main(int argc, char **argv) 617 { 618 (void) argc; 619 (void) argv; 620 return ftdi_init(ftdic); 621 } 622 endef 623 export FTDI_TEST 624 625 define UTSNAME_TEST 626 #include <sys/utsname.h> 627 struct utsname osinfo; 628 int main(int argc, char **argv) 629 { 630 (void) argc; 631 (void) argv; 632 uname (&osinfo); 633 return 0; 634 } 635 endef 636 export UTSNAME_TEST 637 592 638 features: compiler 593 639 @echo "FEATURES := yes" > .features.tmp 640 ifeq ($(CONFIG_FT2232_SPI), yes) 594 641 @printf "Checking for FTDI support... " 595 @$(shell ( echo "#include <ftdi.h>"; \ 596 echo "struct ftdi_context *ftdic = NULL;"; \ 597 echo "int main(int argc, char **argv)"; \ 598 echo "{ (void) argc; (void) argv; return ftdi_init(ftdic); }"; ) > .featuretest.c ) 642 @echo "$$FTDI_TEST" > .featuretest.c 599 643 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \ 600 644 ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \ 601 645 ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp ) 646 endif 602 647 @printf "Checking for utsname support... " 603 @$(shell ( echo "#include <sys/utsname.h>"; \ 604 echo "struct utsname osinfo;"; \ 605 echo "int main(int argc, char **argv)"; \ 606 echo "{ (void) argc; (void) argv; uname (&osinfo); return 0; }"; ) > .featuretest.c ) 648 @echo "$$UTSNAME_TEST" > .featuretest.c 607 649 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \ 608 650 ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) || \ … … 610 652 @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features 611 653 @rm -f .featuretest.c .featuretest$(EXEC_SUFFIX) 612 else613 features: compiler614 @echo "FEATURES := yes" > .features.tmp615 @printf "Checking for utsname support... "616 @$(shell ( echo "#include <sys/utsname.h>"; \617 echo "struct utsname osinfo;"; \618 echo "int main(int argc, char **argv)"; \619 echo "{ (void) argc; (void) argv; uname (&osinfo); return 0; }"; ) > .featuretest.c )620 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \621 ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) || \622 ( echo "not found."; echo "UTSNAME := no" >> .features.tmp )623 @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features624 @rm -f .featuretest.c .featuretest$(EXEC_SUFFIX)625 endif626 654 627 655 install: $(PROGRAM)$(EXEC_SUFFIX)
Note: See TracChangeset
for help on using the changeset viewer.
