Makefile: clean up Makefile
authorBrian Norris <banorris@uci.edu>
Mon, 21 May 2012 16:47:05 +0000 (09:47 -0700)
committerBrian Norris <banorris@uci.edu>
Mon, 21 May 2012 17:00:16 +0000 (10:00 -0700)
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

index 1326dc0048e68d5cbd6f03de2388ebe3f10d41bc..43be84d8a4cf6107756852d9beccf1dc0a9810b3 100644 (file)
--- 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)