From: Brian Norris Date: Mon, 21 May 2012 16:47:05 +0000 (-0700) Subject: Makefile: clean up Makefile X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2aa9c9540491284f29464e9756b8896f2cbbc8c8;p=cdsspec-compiler.git 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 --- diff --git a/Makefile b/Makefile index 1326dc0..43be84d 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)