# Export all variables by default export .PHONY : all dynamic semistatic static install install-dynamic install-static install-header uninstall uninstall-dynamic uninstall-static uninstall-header clean purge help test doc style check ### Versions ### # Current version of the libowlps LIBOWLPS_VERSION := 3.0 # OwlPS source version ifndef OWLPS_VERSION OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION') endif ### make-related variables ### # Default make command # Use MAKE=gmake on BSD systems. ifndef MAKE MAKE := make endif # Default Makefile name ifndef MAKEFILE MAKEFILE := Makefile endif # Default target to call, when calling a Makefile from another Makefile ifndef TARGET TARGET := all endif # Target architecture # This is unused for now. ifndef ARCH ARCH := native endif ### Building tools ### # Misc tools AR := ar RANLIB := ranlib STRIP := strip -s # Install/uninstall commands CP := cp MKDIR := mkdir -p RM := rm -f RM_RECURSIVE := \rm -fr SYMLINK := ln -sf # C compiler ifeq "$(origin CC)" "default" CLANG := $(shell command -v clang >/dev/null ; echo $$?) ifeq "$(CLANG)" "0" CC := clang else COLORGCC := $(shell command -v colorgcc >/dev/null ; echo $$?) ifeq "$(COLORGCC)" "0" CC := colorgcc endif endif endif # C++ compiler ifeq "$(origin CXX)" "default" COLORGCC := $(shell which colorgcc >/dev/null 2>&1 ; echo $$?) ifeq "$(COLORGCC)" "0" CXX := colorgcc endif endif ### OwlPS-specific variables ### LIBOWLPS_DIR = ../libowlps LIBOWLPSCLIENT_DIR = ../libowlps-client LIBOWLPSRESULTREADER_DIR = ../libowlps-resultreader ### Build flags ### # Reinitialisation CPPFLAGS := CFLAGS := CXXFLAGS := LDFLAGS := ## OpenWrt specifics ## # # To compile for OpenWrt, the OPENWRT_VERSION variable must be set. # The other relevant variables are: # OPENWRT_ROOT: path to the base directory in which the OpenWrt stuff # is (default: $HOME/openwrt). # OPENWRT_TARGET: name of the OpenWrt target to build for (default: # atheros). # # To allow building against several targets and OpenWrt versions, we # look for the toolchain in the following base directory, taking into # account specificities of each version when needed: # $OPENWRT_ROOT/$OPENWRT_TARGET/$OPENWRT_VERSION # # For maintainability's sake, we don't handle changes of version of the # toolchain's tools, so you have to create symbolic links under this # directory: # target_uClibc --> staging_dir/target-$ARCH_*_uClibc-* # toolchain_gcc_uClibc --> staging_dir/toolchain-$ARCH_*_gcc-*_uClibc-* # # See the documentation in INSTALL.t2t for further information on how to # set up a building environment for OpenWrt. # ifndef OPENWRT_PATH OPENWRT_ROOT = $${HOME}/openwrt endif ifndef OPENWRT_TARGET OPENWRT_TARGET := atheros endif ifdef OPENWRT_VERSION TOOLCHAIN_PREFIX := $(OPENWRT_ROOT)/$(OPENWRT_TARGET)/$(OPENWRT_VERSION) STAGING_DIR := $(TOOLCHAIN_PREFIX)/staging_dir TOOLCHAIN1 := $(TOOLCHAIN_PREFIX)/toolchain_gcc_uClibc TOOLCHAIN_BIN := $(TOOLCHAIN1)/bin TOOLCHAIN2 := $(TOOLCHAIN_PREFIX)/target_uClibc ifeq "$(OPENWRT_VERSION)" "10.03" TOOLCHAIN_BIN := $(TOOLCHAIN1)/usr/bin endif CFLAGS += -I$(TOOLCHAIN1)/usr/include -I$(TOOLCHAIN2)/usr/include LDFLAGS += -L$(TOOLCHAIN1)/lib -L$(TOOLCHAIN1)/usr/lib -L$(TOOLCHAIN2)/usr/lib DYNAMIC_LDFLAGS += $(TOOLCHAIN1)/lib/ld-uClibc.so.0 SEMISTATIC_LDFLAGS += $(TOOLCHAIN1)/lib/ld-uClibc.so.0 CC := STAGING_DIR=$(STAGING_DIR) $(TOOLCHAIN_BIN)/mips-openwrt-linux-gcc CXX := STAGING_DIR=$(STAGING_DIR) $(TOOLCHAIN_BIN)/mips-openwrt-linux-g++ STRIP := STAGING_DIR=$(STAGING_DIR) $(TOOLCHAIN_BIN)/mips-openwrt-linux-strip -s endif # OwlPS flags CFLAGS += -D OWLPS_VERSION=\"$(OWLPS_VERSION)\" LDFLAGS += -L$(LIBOWLPS_DIR) -L$(LIBOWLPSCLIENT_DIR) -L$(LIBOWLPSRESULTREADER_DIR) CFLAGS += -I$(LIBOWLPS_DIR) -I$(LIBOWLPSCLIENT_DIR) -I$(LIBOWLPSRESULTREADER_DIR) # Options CFLAGS += -O2 CFLAGS += -fPIC CFLAGS += -Wall -Wextra # Debug flags CFLAGS += -D DEBUG #CFLAGS += -g -O0 #CFLAGS += -D NDEBUG # Misc #STRIPFLAGS += -Wl,-s # OS specific flags OS := $(shell uname) ifeq "$(OS)" "DragonFly" CFLAGS += -I/usr/pkg/include LDFLAGS += -L/usr/pkg/lib endif ifeq "$(OS)" "NetBSD" CFLAGS += -I/usr/pkg/include LDFLAGS += -L/usr/pkg/lib endif ifeq "$(OS)" "OpenBSD" CFLAGS += -I/usr/local/include LDFLAGS += -L/usr/local/lib endif # C++ specific flags CXXFLAGS := $(CFLAGS) # C specific flags CFLAGS += -Wstrict-prototypes ### Installation directories ### PREFIX := /usr/local INSTALL_DIR := $(PREFIX)/bin INSTALL_LIB := $(PREFIX)/lib INSTALL_INC := $(PREFIX)/include INSTALL_MAN := $(PREFIX)/share/man