]> git.tdb.fi Git - libs/core.git/blob - Makefile
globcasematch takes a std::string, not Path
[libs/core.git] / Makefile
1 NAME            = path
2
3 WORKDIR         = $(PWD)/../..
4 TMP             = $(WORKDIR)/tmp/linux
5 TGT             = $(HOME)/local
6
7 CXX             = g++
8 CC              = gcc
9 AR              = ar
10 CP              = cp
11
12 LIBFILE         = libmsp$(NAME)
13
14 MAKEFLAGS       += -s --no-print-directory
15 INCLUDE         = -Isource -I$(TMP)/include
16 LIB             = -L$(TMP)
17 DEBUG           = 
18 CFLAGS          = $(DEBUG) $(INCLUDE) -pipe -Wall 
19 CXXFLAGS        = $(CFLAGS)
20
21 PIC             = -fPIC
22 SHARED          = .so
23 STATIC          = .a
24
25 SRC             = source
26 OBJS            = $(addprefix $(TMP)/, $(addsuffix .o, $(notdir $(basename $(wildcard $(SRC)/*.cpp)))))
27
28 pkgincludedir   = include/msp/$(NAME)
29 libdir          = lib
30
31 .PHONY: all
32 all: $(TMP) $(TMP)/$(LIBFILE)$(SHARED) $(TMP)/$(LIBFILE)$(STATIC) tmpheaders
33
34 # Create temp directory
35 $(TMP):
36         mkdir -p $@
37
38 # Dynamic library
39 $(TMP)/$(LIBFILE)$(SHARED): $(OBJS)
40         echo "Compiling $(notdir $@)"
41         $(CXX) $^ -shared -o $@ $(LIB) $(LDFLAGS)
42
43 # Static library
44 $(TMP)/$(LIBFILE)$(STATIC): $(OBJS)
45         echo "Compiling $(notdir $@)"
46         $(AR) rcs $@ $^
47
48 # Copy headers to temp
49 .PHONY: tmpheaders
50 tmpheaders: $(TMP)/$(pkgincludedir)
51         $(CP) $(SRC)/*.h $<
52
53 $(TMP)/$(pkgincludedir):
54         mkdir -p $@
55
56 # Library object file
57 $(TMP)/%.o: $(SRC)/%.cpp $(wildcard $(SRC)/*.h)
58         echo "Compiling $(NAME)/$(notdir $(basename $@))"
59         $(CXX) $(PIC) $(CXXFLAGS) -c $< -o $@
60
61 # Installs
62 .PHONY: install
63 install: install_lib 
64
65 $(TGT)/$(pkgincludedir):
66         mkdir -p $@
67
68 $(TGT)/$(libdir):
69         mkdir -p $@
70
71 .PHONY: install_headers
72 install_headers: $(TGT)/$(pkgincludedir)
73         echo "Installing $(NAME) headers to $<"
74         $(CP) $(SRC)/*.h $<
75
76 .PHONY: install_lib
77 install_lib: $(TGT)/$(libdir) $(TMP)/$(LIBFILE)$(SHARED)
78         echo "Installing dynamic library to $<"
79         $(CP) $(TMP)/$(LIBFILE)$(SHARED) $<
80
81 .PHONY: install_staticlib
82 install_staticlib: $(TGT)/$(libdir) $(TMP)/$(LIBFILE)$(STATIC)
83         echo "Installing static library to $<"
84         $(CP) $(TMP)/$(LIBFILE)$(STATIC) $<