#Makefile. Compiling and linking files in a project

9 messages · Page 1 of 1 (latest)

olive plumeBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

silver gyro
#

As a bump and update

#

My makefile now looks like this

#
CFLAGS   = -g3 -Wall
LDFLAGS  =
OBJFILES = common_ipcs.o utils.o
OBJFILES2 = nave.o porto.o meteo.o
TARGET   = master


# the object files once compiled need to be put in the source directory
# so that the linker can find them

all: prep $(TARGET) run

# With prep we want to compile nave.o, porto.o and meteo.o, by linking them with common_ipcs.o and utils.o
prep: $(addprefix source/, $(OBJFILES) $(OBJFILES2))

# With target we want to link master.o with the object files created in prep and the libraries
$(TARGET): $(addprefix source/, $(OBJFILES)) source/master.o
    $(CC) $(LDFLAGS) -o $@ $^

run:
    # run the program
    #print target $(TARGET)
    ./$(TARGET)```
#

It compiles as expected and puts the master in the root directory. When I try to run it though, since it uses execv to run nave.o it says permission denied which I suppose means I compiled bullshit

silver gyro
#

Update:

#

This works now. How can I minimise this?

olive plumeBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.

olive plumeBOT
#

This question thread is being automatically marked as solved.