Thread: Makefile

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    99

    Makefile

    Dear experts,

    i have written a make file for windows which is working quite well,
    but i want to get the count of number of files which i am not getting can anyone please help me my makefile is as follows,
    Code:
    main :
               
    		for /r ${CWD} %%X in (*.txt) do (echo %%X)
    	
    	
    all : main
    	echo "Hello "
    	echo ${make}
    	 C:\MinGW\bin\make main
    this is showing all the files in that directory with extension .txt , can any body help me how to get its count means number of files. what ever i am modifying it is giving me error i am trying this with eclipse with minGW installed. i tried like:
    Code:
    main:
            set /A Count =0
            for /r ${CWD} %%X in (*.txt) do ( set /A Count+=1)
            echo %Count%
    but this is not working .

    please help me.

  2. #2
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    You can't use make to loop based on a changing state. You need to use something else.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    99
    Thanks for the reply,

    but this is working know,

    like
    Code:
    main :
               
    		for /r ${CWD} %%X in (*.txt) do (echo %%X)
    	
    	
    all : main
    	echo "Hello "
    	echo ${make}
    	 C:\MinGW\bin\make main
    which is listing all the txt files from the current directory then why it cannot take out the count,
    please help me if any alternate please inform me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefile help please
    By TriKri in forum C++ Programming
    Replies: 3
    Last Post: 09-24-2009, 12:36 AM
  2. Replies: 2
    Last Post: 08-11-2009, 06:45 AM
  3. Building a project using a Makefile
    By starcatcher in forum Windows Programming
    Replies: 2
    Last Post: 11-23-2008, 11:50 PM
  4. makefile
    By twans in forum C++ Programming
    Replies: 3
    Last Post: 04-08-2005, 12:16 AM
  5. Need help with Makefile
    By xshapirox in forum C++ Programming
    Replies: 14
    Last Post: 09-28-2004, 03:32 PM