From 2aa9c9540491284f29464e9756b8896f2cbbc8c8 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Mon, 21 May 2012 09:47:05 -0700 Subject: [PATCH] Makefile: clean up Makefile There are a number of inconsistencies and superfluous arguments: - For libmymemory, we don't need (or want) to hardcode a shared library relative path - For libmodel, we don't really need the 'soname' parameter - Linking C++ probably should be done with the C++ compiler, not the C compiler - We don't need CPPFLAGS for linking-only stages - We want to use LDFLAGS for an early-stage linking rather than the late-stage linking of the user program Overall, simpler is better --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1326dc00..43be84d8 100644 --- a/Makefile +++ b/Makefile @@ -24,15 +24,15 @@ LDFLAGS=-ldl -lrt all: $(BIN) $(BIN): $(USER_O) $(LIB_SO) $(LIB_MEM_SO) - $(CXX) -o $(BIN) $(USER_O) -L. -l$(LIB_NAME) -l$(LIB_MEM) $(CPPFLAGS) $(LDFLAGS) + $(CXX) -o $(BIN) $(USER_O) -L. -l$(LIB_NAME) -l$(LIB_MEM) # note: implicit rule for generating $(USER_O) (i.e., userprog.c -> userprog.o) $(LIB_SO): $(MODEL_O) $(MODEL_H) - $(CXX) -shared -Wl,-soname,$(LIB_SO) -o $(LIB_SO) $(MODEL_O) $(LDFLAGS) $(CPPFLAGS) + $(CXX) -shared -o $(LIB_SO) $(MODEL_O) $(LDFLAGS) $(LIB_MEM_SO): $(SHMEM_O) $(SHMEM_H) - $(CC) -shared -W1,rpath,"." -o $(LIB_MEM_SO) $(SHMEM_O) + $(CXX) -shared -o $(LIB_MEM_SO) $(SHMEM_O) $(LDFLAGS) malloc.o: malloc.c $(CC) -fPIC -c malloc.c -DMSPACES -DONLY_MSPACES $(CPPFLAGS) -- 2.34.1