Skip to content

Commit ef5258d

Browse files
Adding the static library for smithlab_cpp not intended to be used as a static lirary but to replace having to always specify so many object files
1 parent 01d2b99 commit ef5258d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile from smithlab_cpp C++ code library
22
#
3-
# Copyright (C) 2010 University of Southern California and
4-
# Andrew D. Smith
3+
# Copyright (C) 2010-2019 University of Southern California and
4+
# Andrew D. Smith
55
#
66
# Authors: Andrew D. Smith
77
#
@@ -18,6 +18,9 @@
1818

1919
SOURCES = $(filter-out SAM.cpp,$(wildcard *.cpp))
2020
OBJECTS = $(patsubst %.cpp,%.o,$(SOURCES))
21+
HEADERS = $(wildcard *.hpp)
22+
23+
STATIC_LIB = libsmithlab_cpp.a
2124

2225
CXX = g++
2326
CXXFLAGS = -Wall -std=c++11
@@ -37,6 +40,13 @@ all: $(OBJECTS)
3740
%.o: %.cpp %.hpp
3841
$(CXX) $(CXXFLAGS) -c -o $@ $< $(INCLUDEARGS)
3942

43+
%.o: %.cpp %.hpp
44+
$(CXX) $(CXXFLAGS) -c -o $@ $< $(INCLUDEARGS)
45+
46+
static: $(OBJECTS) $(HEADERS)
47+
ar cru $(STATIC_LIB) $^
48+
49+
4050
clean:
41-
@-rm -f *.o *~
51+
@-rm -f *.o *.a *~
4252
.PHONY: clean

0 commit comments

Comments
 (0)