Skip to content

Commit

Permalink
Makefile: build static library with libdramsim.a
Browse files Browse the repository at this point in the history
Signed-off-by: Emilio G. Cota <cota@braap.org>
  • Loading branch information
cota committed Nov 4, 2014
1 parent 6879141 commit a016449
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ results/
*.deppo
*.swp
DRAMSim
libdramsim.a
libdramsim.so
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ endif
CXXFLAGS+=$(OPTFLAGS)

EXE_NAME=DRAMSim
STATIC_LIB_NAME := libdramsim.a
LIB_NAME=libdramsim.so
LIB_NAME_MACOS=libdramsim.dylib

Expand All @@ -22,7 +23,7 @@ LIB_OBJ := $(addsuffix .o, $(basename $(LIB_SRC)))
#build portable objects (i.e. with -fPIC)
POBJ = $(addsuffix .po, $(basename $(LIB_SRC)))

REBUILDABLES=$(OBJ) ${POBJ} $(EXE_NAME) $(LIB_NAME)
REBUILDABLES=$(OBJ) ${POBJ} $(EXE_NAME) $(LIB_NAME) $(STATIC_LIB_NAME)

all: ${EXE_NAME}

Expand All @@ -35,6 +36,9 @@ $(LIB_NAME): $(POBJ)
g++ -g -shared -Wl,-soname,$@ -o $@ $^
@echo "Built $@ successfully"

$(STATIC_LIB_NAME): $(LIB_OBJ)
$(AR) crs $@ $^

$(LIB_NAME_MACOS): $(POBJ)
g++ -dynamiclib -o $@ $^
@echo "Built $@ successfully"
Expand Down

0 comments on commit a016449

Please sign in to comment.