-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
33 lines (26 loc) · 883 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
TOPDIR=.
TO_TOPDIR=$(TOPDIR)
ifndef SRCDIR
SRCDIR=$(shell pwd)
endif
TOPOBJDIR = $(shell ls -d `pwd`/$(TOPDIR))
NAME = libint
VERSION = 2
NAMEV = $(NAME)$(VERSION)
TARGET = $(NAMEV).$(LIBSUF)
include $(TOPDIR)/MakeVars
include $(TOPDIR)/MakeRules
include $(TOPDIR)/MakeSuffixRules
VPATH = $(SRCTOPDIR)/src $(SRCTOPDIR)/include
TRUESRC = $(shell echo `find src -name '*.cc' -exec echo -n '{} ' \;`)
LIBOBJ = $(TRUESRC:%.cc=%.$(OBJSUF))
default:: $(TOPDIR)/lib/$(TARGET)
# this is how the static library is made
# NOTE: the library is made from scratch every time and the prerequisite variable is not used to avoid overflow
$(TOPDIR)/lib/$(NAMEV).a: $(LIBOBJ)
/bin/rm -f $@
find src -name '*.$(OBJSUF)' -print0 | xargs -0 $(AR) $(ARFLAGS) $@
$(RANLIB) $@
# this is how shared library is made
$(TOPDIR)/lib/$(NAMEV).la: $(LIBOBJ)
$(LTLINK) $(CXX) -o $@ $^ $(LTLINKLIBOPTS)