From: Niko Liikanen Date: Wed, 23 Aug 2006 22:32:42 +0000 (+0000) Subject: First version X-Git-Tag: 1.0~49 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=668be7968f8327f3aa613189c4f7b43f377ffb07;p=libs%2Fcore.git First version --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b88954c --- /dev/null +++ b/Makefile @@ -0,0 +1,75 @@ +TMP = $(HOME)/nightwatch/tmp +TGT = $(HOME)/nightwatch + +CXX = g++ +CC = gcc +AR = ar +CP = cp +INCLUDE = -Isource -I$(TMP)/include +LIB = -L$(TMP) +DEBUG = +CFLAGS = $(DEBUG) $(INCLUDE) -pipe -Wall `pkg-config --cflags sigc++-2.0` `sdl-config --cflags` +CXXFLAGS = $(CFLAGS) + +LIBRARY = framework +LIBFILE = libmspframework +SRC = source +LIBOBJS = $(addprefix $(TMP)/, $(addsuffix .o, $(notdir $(basename $(wildcard $(SRC)/*.cpp))))) + +pkgincludedir = include/msp/$(LIBRARY) +libdir = lib + +.PHONY: all +all: $(TMP) $(TMP)/$(LIBFILE).so $(TMP)/$(LIBFILE).a tmpheaders + +# Create temp directory +$(TMP): + mkdir -p $@ + +# Dynamic library +$(TMP)/$(LIBFILE).so: $(LIBOBJS) + echo "Compiling $(notdir $@)" + $(CXX) $^ -shared -o $@ $(LIB) $(LIBRARYLIBS) + +# Static library +$(TMP)/$(LIBFILE).a: $(LIBOBJS) + echo "Compiling $(notdir $@)" + $(AR) rcs $@ $^ + +# Copy headers to temp +.PHONY: tmpheaders +tmpheaders: $(TMP)/$(pkgincludedir) + $(CP) $(SRC)/*.h $< + +$(TMP)/$(pkgincludedir): + mkdir -p $@ + +# Library object file +$(TMP)/%.o: $(SRC)/%.cpp $(wildcard $(SRC)/*.h) + echo "Compiling $(LIBRARY)/$(notdir $(basename $@))" + $(CXX) -fPIC $(CXXFLAGS) -c $< -o $@ + +# Installs +.PHONY: install +install: install_headers install_lib install_staticlib + +$(TGT)/$(pkgincludedir): + mkdir -p $@ + +$(TGT)/$(libdir): + mkdir -p $@ + +.PHONY: install_headers +install_headers: $(TGT)/$(pkgincludedir) + echo "Installing $(LIBRARY) headers to $<" + $(CP) $(SRC)/*.h $< + +.PHONY: install_lib +install_lib: $(TGT)/$(libdir) $(TMP)/$(LIBFILE).so + echo "Installing dynamic library to $<" + $(CP) $(TMP)/$(LIBFILE).so $< + +.PHONY: install_staticlib +install_staticlib: $(TGT)/$(libdir) $(TMP)/$(LIBFILE).a + echo "Installing static library to $<" + $(CP) $(TMP)/$(LIBFILE).a $<