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.
This commit is contained in:
Matteo Cypriani 2013-05-01 11:13:49 -04:00
parent 64c2ac9a58
commit 9d18c1b598
2 changed files with 17 additions and 7 deletions

View File

@ -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)

View File

@ -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