1 TMP = $(HOME)/nightwatch/tmp
2 TGT = $(HOME)/nightwatch
8 INCLUDE = -Isource -I$(TMP)/include
11 CFLAGS = $(DEBUG) $(INCLUDE) -pipe -Wall `pkg-config --cflags sigc++-2.0` `sdl-config --cflags`
17 LIBOBJS = $(addprefix $(TMP)/, $(addsuffix .o, $(notdir $(basename $(wildcard $(SRC)/*.cpp)))))
19 pkgincludedir = include/msp/$(LIBRARY)
23 all: $(TMP) $(TMP)/$(LIBFILE).so $(TMP)/$(LIBFILE).a tmpheaders
25 # Create temp directory
30 $(TMP)/$(LIBFILE).so: $(LIBOBJS)
31 echo "Compiling $(notdir $@)"
32 $(CXX) $^ -shared -o $@ $(LIB) $(LIBRARYLIBS)
35 $(TMP)/$(LIBFILE).a: $(LIBOBJS)
36 echo "Compiling $(notdir $@)"
39 # Copy headers to temp
41 tmpheaders: $(TMP)/$(pkgincludedir)
44 $(TMP)/$(pkgincludedir):
48 $(TMP)/%.o: $(SRC)/%.cpp $(wildcard $(SRC)/*.h)
49 echo "Compiling $(LIBRARY)/$(notdir $(basename $@))"
50 $(CXX) -fPIC $(CXXFLAGS) -c $< -o $@
54 install: install_headers install_lib install_staticlib
56 $(TGT)/$(pkgincludedir):
62 .PHONY: install_headers
63 install_headers: $(TGT)/$(pkgincludedir)
64 echo "Installing $(LIBRARY) headers to $<"
68 install_lib: $(TGT)/$(libdir) $(TMP)/$(LIBFILE).so
69 echo "Installing dynamic library to $<"
70 $(CP) $(TMP)/$(LIBFILE).so $<
72 .PHONY: install_staticlib
73 install_staticlib: $(TGT)/$(libdir) $(TMP)/$(LIBFILE).a
74 echo "Installing static library to $<"
75 $(CP) $(TMP)/$(LIBFILE).a $<