0

Hi,

I'm trying to make a makefile but after i enter the command
make makefile
it says nothing to be made in the makefile, can someone please help me?
Nd.c depends on Pd.h
Pd.c depends on Pd.h
Md.c depends on md.h
md.h depends on Rd.h

# Makefile

CC = gcc
LD = $(CC)
DEPEND = mkdep

CFLAGS = -O2 -Wall

CFILES =\
Nd.c\
Pd.c\
Md.c

HFILES =\
md.h\
Pd.h\
Rd.h

OFILES = $(CFILES:%.c=%.o)

myprogram: $(OFILES)
$(LD) -o $@ $(OFILES)

Nd.o: Nd.c Pd.h

Pd.o: Pd.c Pd.h

Md.o: Md.c md.h

md.h: Rd.h

depend:
$(DEPEND) $(CFLAGS) $(CFILES)

clean:
rm -f *.o *.bak

2
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by wsn
0

Thank you that really helped i didn't know i was running the command wrong
but still my makefile isn't working i tried to simplify it more but the last two dependencies aren't working

myprogram: Nd.o Pd.o Md.c
gcc Nde.o Pd.o Md.o -o myprogram
Nd.o:
gcc -c Nd.c
Pd.o:
gcc -c Pd.c
Md.o: Md.c md.h
gcc -c Md.c
md.h: Rd.h

1

are you using <TAB> in front of each command? i cant tell since youre not using code-tags.

dont "simplify" it until you get it to work in the first place. go back to the beginning and adhere strictly to your dependency graph

________   ________   ________
| ND.C |   | PD.C |   | MD.C |
========   ========   ========  
    |____  ____|          |
        |  |              |
      __V__V__        ____V___
      | PD.H |        | MD.H |
      ========        ========
                          |
                      ____V___
                      | RD.H |
                      ========

Edited by mike_2000_17: Fixed formatting

Votes + Comments
Very helpful gave me a very good hint where I was lost thank you
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.