Thread: about Makefile and Macro

  1. #1
    Registered User tom_mk's Avatar
    Join Date
    Feb 2002
    Posts
    3

    about Makefile and Macro

    Helllo,,, guys..

    i'm kind of newbies for c++

    here is my problem..

    i'm now taking a CPSC course
    and one of the lab that i'm doing is about Makefile

    here is my Makefile

    Code:
    CC = gcc                                # Compiler
    
    CFLAGS = -D_POSIX_SOURCE=1		# Compiler flags
    ## OLD CFLaG ##  -c -I./lib                     
    
    LFLAGS =                                # Linker flags
    
    LIBS = -L./usr/X/lib -lXaw -lXmu -lXt -lX11 -lsx        # Library ## old
    
    
    ## LIBS = libsx.a		                # Library ## new
    
    SRCS = button.c colormap.c Dialog.c draw.c DrawingA.c font.c libsx.c list.c menu.c misc.c popups.c scrollbar.c string_entry.c toggle.c version.c 
    
    PROG_OBJS =  $(SRCS:.c:.o)              # Object files
    
    PROG = courses                          # Executable name
    
    RM = /bin/rm -f                          # For cleaning
    
     
    $(PROG): $(PROG_OBJS)
    	$(CC) $(LFLAGS) $(PROG_OBJS) $(LIBS) -o $(PROG)
    
    %.o : %.c
    	$(CC) -c $(CFLAGS) $< -o $@
    
    .SUFFIXES: .c
     
    .c.o:
    	$(CC) $(CFLAGS) -c $<
     
    clean:
    	rm -f  $(PROG_OBJS) $(PROG) *~
    
    depend:
    	makedepend -- $(CFLAGS) -- $(SRCS)
    i'm now having a problem with
    Define macro _POSIX_SOURCE with the string "1"

    i am asked to define this macro with the value "1"
    i then insert this
    Code:
    -D_POSIX_SOURCE=1
    to my CFLAGS

    i believe that everythign should be fine; however, i still receive this err

    bowen:~/tom/lab2/libsx/src> make Makefile
    mksh: Fatal error in reader: = missing from replacement macro reference
    Current working directory /galiano1/i3x3/tom/lab2/libsx/src
    i ran this command in secureCRT, and fixing Makefile in X-win32

    anybody can help me with the question

    i'd be really appreciate
    i really need it within the next 8-10 hr if it's possible...
    thx very muchh guyss

  2. #2
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    A guess...

    I think makefiles are system dependent, and I've only used Microsoft... and even then I've usually copied/modified an existing file.

    My guess: You probably can't have two equal signs on a line.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. macro function
    By freeindy in forum C Programming
    Replies: 6
    Last Post: 11-08-2007, 05:04 AM
  2. Read a macro from a .h into Makefile
    By hzmonte in forum C Programming
    Replies: 6
    Last Post: 11-17-2005, 03:19 AM
  3. g++ error: Macro names must be identifiers.
    By eccles in forum C++ Programming
    Replies: 2
    Last Post: 01-15-2005, 03:28 AM