From 4c400449ae97e00a88a244071bf37aad143b036a Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Mon, 19 Feb 2024 04:58:37 +0000 Subject: [PATCH] Object relocation example keep main.o --- examples/object-relocations/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/object-relocations/Makefile b/examples/object-relocations/Makefile index f86dbf3..ac108b0 100644 --- a/examples/object-relocations/Makefile +++ b/examples/object-relocations/Makefile @@ -6,8 +6,11 @@ TARGET = exe # Default rule all: $(TARGET) -$(TARGET): main.c sum.o - $(CC) $(CFLAGS) -o $(TARGET) main.c sum.o +$(TARGET): main.o sum.o + $(CC) $(CFLAGS) -o $(TARGET) main.o sum.o + +main.o: main.c sum.h + $(CC) $(CFLAGS) -c main.c sum.o: sum.c sum.h $(CC) $(CFLAGS) -c sum.c @@ -15,4 +18,4 @@ sum.o: sum.c sum.h .PHONY: clean clean: - rm -f $(TARGET) sum.o \ No newline at end of file + rm -f $(TARGET) sum.o main.o \ No newline at end of file