From 9d18c1b598335759f88798a94710a5d813111203 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Wed, 1 May 2013 11:13:49 -0400 Subject: [PATCH] Makefile: adapt targets to the OS The Listener is built only on Linux, the Positioner is not built on OpenBSD. Some other changes might be required. In common.mk, the OS is forced to Linux if we build for OpenWrt, which should allow to cross-compile from BSD systems. --- Makefile | 18 ++++++++++++------ common.mk | 6 +++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 90a20a9..337b5ee 100644 --- a/Makefile +++ b/Makefile @@ -25,18 +25,24 @@ include common.mk ## Compilation ## -all: \ - c \ - owlps-positioner - -c: \ +C_TARGETS := \ libowlps \ libowlps-client \ libowlps-resultreader \ owlps-client \ - owlps-listener \ owlps-aggregator \ owlps-udp-to-http +ifeq "$(OS)" "Linux" + C_TARGETS += owlps-listener +endif + +ALL_TARGETS := $(C_TARGETS) +ifneq "$(OS)" "OpenBSD" + ALL_TARGETS += owlps-positioner +endif + +all: $(ALL_TARGETS) +c: $(C_TARGETS) libowlps: @$(MAKE) -C $@ $(ARG) diff --git a/common.mk b/common.mk index 5a6a127..e71e3c1 100644 --- a/common.mk +++ b/common.mk @@ -91,6 +91,9 @@ CFLAGS := CXXFLAGS := LDFLAGS := +# OS detection +OS := $(shell uname) + ## OpenWrt specifics ## # # To compile for OpenWrt, the OPENWRT_VERSION variable must be set. @@ -121,6 +124,8 @@ ifndef OPENWRT_TARGET OPENWRT_TARGET := atheros endif ifdef OPENWRT_VERSION + OS := Linux + TOOLCHAIN_PREFIX := $(OPENWRT_ROOT)/$(OPENWRT_TARGET)/$(OPENWRT_VERSION) STAGING_DIR := $(TOOLCHAIN_PREFIX)/staging_dir TOOLCHAIN1 := $(TOOLCHAIN_PREFIX)/toolchain_gcc_uClibc @@ -160,7 +165,6 @@ CFLAGS += -D DEBUG #STRIPFLAGS += -Wl,-s # OS specific flags -OS := $(shell uname) ifeq "$(OS)" "DragonFly" CFLAGS += -I/usr/pkg/include LDFLAGS += -L/usr/pkg/lib