Create a Makefile that supports the following targets and dependencies. Target g
ID: 3667201 • Letter: C
Question
Create a Makefile that supports the following targets and dependencies. Target game depends on all.o files that are needed to generate the final executable file game .A.o file depends on the corresponding.cc file plus any.h files that are included in the .cc file Target archive uses "tar" command to create a zipped tarbaleg .tar.gz files or .tgz files) with all source files, include Makefile itself The following targets must be implemented o o o o all (the default target, must include build and archive) clean (cleans all generated files, including the executable file) build archive Source files needed to build executable "game" are distributed in a separate zip file "HW5.SampleProject.zip".Explanation / Answer
IDIR =../include CC=gcc CFLAGS=-I$(IDIR) ODIR=obj LDIR =../lib LIBS=-lm _DEPS = colors.h DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) _OBJ = game.o main.o OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) $(ODIR)/%.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) main: $(OBJ) gcc -o $@ $^ $(CFLAGS) $(LIBS) .PHONY: clean clean: rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.