Simplified host OS platform detection in Makefiles

This commit is contained in:
Ilya Dmitrichenko 2012-02-21 23:57:22 +00:00 committed by David Kopf
parent 745f071c98
commit 9c99d46e24
17 changed files with 66 additions and 134 deletions

View file

@ -11,14 +11,6 @@ ifndef CONTIKI
$(error CONTIKI not defined!)
endif
ifndef WINDIR
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
WINDIR := Windows
endif
endif
endif
### Assuming simulator quickstart if no JNI library name set from Cooja
ifndef LIBNAME
QUICKSTART=1

View file

@ -68,23 +68,15 @@ send: $(CONTIKI)/tools/codeprop.c
### System dependent Makefile
ifndef WINDIR
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
WINDIR := Windows
endif
endif
endif
ifeq (${HOSTTYPE},FreeBSD)
ifeq ($(HOST_OS),FreeBSD)
# settings for FreeBSD
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd
else
ifndef WINDIR
# settings for unix
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix
else
# settings for windows
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win
endif
ifeq ($(HOST_OS),Windows)
# settings for Windows
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win
else
# settings for an arbitary unix-like platform
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix
endif
endif

View file

@ -31,23 +31,15 @@ include $(CONTIKIAVR)/Makefile.avr
avr-objdump -zhD $< > $@
ifndef WINDIR
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
WINDIR := Windows
endif
endif
endif
ifeq ($(PRGBOARD), )
PRGBOARD = mib510
endif
ifeq ($(PORT), )
ifndef WINDIR
PORT = /dev/ttyUSB0
else
ifeq ($(HOST_OS), Windows)
PORT = COM1
else
PORT = /dev/ttyUSB0
endif
endif

View file

@ -19,10 +19,8 @@ include $(CONTIKI)/cpu/stm32w108/Makefile.stm32w108
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-linux
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows
endif
ifeq ($(HOST_OS),Windows)
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows
endif

View file

@ -18,10 +18,8 @@ include $(CONTIKI)/cpu/stm32w108/Makefile.stm32w108
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-linux
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows
endif
ifeq ($(HOST_OS),Windows)
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows
endif

View file

@ -26,23 +26,15 @@ include $(CONTIKIAVR)/Makefile.avr
avr-objdump -zhD $< > $@
ifndef WINDIR
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
WINDIR := Windows
endif
endif
endif
ifeq ($(PRGBOARD), )
PRGBOARD = mib510
endif
ifeq ($(PORT), )
ifndef WINDIR
PORT = /dev/ttyS0
else
ifeq ($(HOST_OS),Windows)
PORT = COM1
else
PORT = /dev/ttyS0
endif
endif

View file

@ -7,7 +7,7 @@ CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c leds.c leds-arch.c cfs-posix.c cfs-posix-dir.c dlloader.c
ifeq ($(OS),Windows_NT)
ifeq ($(HOST_OS),Windows)
CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c
else
CONTIKI_TARGET_SOURCEFILES += tapdev-drv.c
@ -21,7 +21,7 @@ endif
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
ifeq ($(OS),Windows_NT)
ifeq ($(HOST_OS),Windows)
TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
endif

View file

@ -24,25 +24,17 @@ endif
### System dependent Makefile
ifndef WINDIR
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
WINDIR := Windows
endif
endif
endif
ifeq (${HOSTTYPE},FreeBSD)
ifeq ($(HOST_OS),FreeBSD)
# settings for FreeBSD
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd
else
ifndef WINDIR
# settings for unix
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix
else
# settings for windows
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win
endif
ifeq ($(HOST_OS),Windows)
# settings for Windows
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win
else
# settings for an arbitary unix-like platform
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix
endif
endif
# If we are not running under Windows, we assume Linux

View file

@ -13,7 +13,7 @@ CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c leds.c leds-arch.c \
button-sensor.c pir-sensor.c vib-sensor.c xmem.c \
sensors.c irq.c cfs-posix.c cfs-posix-dir.c
ifeq ($(OS),Windows_NT)
ifeq ($(HOST_OS),Windows)
CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c
TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
else

View file

@ -43,29 +43,27 @@ NUMPAR=20
IHEXFILE=tmpimage.ihex
# Check if we are running under Windows
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
USBDEVPREFIX=/dev/com
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-windows
MOTELIST = $(CONTIKI)/tools/sky/motelist-windows
TMOTE_BSL_FILE = tmote-bsl
TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE).exe),1,0)
ifeq ($(TMOTE_BSL), 1)
NUMPAR = 1
BSL = $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)
MOTES = $(shell $(MOTELIST) | grep COM | \
cut -f 4 -d \ )
else
BSL = $(CONTIKI)/tools/sky/msp430-bsl-windows --telosb
BSL_FILETYPE = -I
MOTES = $(shell $(MOTELIST) | grep COM | \
cut -f 4 -d \ | \
perl -ne 'print $$1 - 1 . " " if(/COM(\d+)/);')
endif
CMOTES = $(shell $(MOTELIST) | grep COM | \
USBDEVPREFIX=/dev/com
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-windows
MOTELIST = $(CONTIKI)/tools/sky/motelist-windows
TMOTE_BSL_FILE = tmote-bsl
TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE).exe),1,0)
ifeq ($(TMOTE_BSL), 1)
NUMPAR = 1
BSL = $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)
MOTES = $(shell $(MOTELIST) | grep COM | \
cut -f 4 -d \ )
else
BSL = $(CONTIKI)/tools/sky/msp430-bsl-windows --telosb
BSL_FILETYPE = -I
MOTES = $(shell $(MOTELIST) | grep COM | \
cut -f 4 -d \ | \
perl -ne 'print $$1 . " " if(/COM(\d+)/);')
perl -ne 'print $$1 - 1 . " " if(/COM(\d+)/);')
endif
CMOTES = $(shell $(MOTELIST) | grep COM | \
cut -f 4 -d \ | \
perl -ne 'print $$1 . " " if(/COM(\d+)/);')
endif
# If we are not running under Windows, we assume Linux

View file

@ -27,12 +27,3 @@ ifndef BASE_IP
BASE_IP := 172.16.1.1
endif
### System dependent Makefile
ifndef WINDIR
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
WINDIR := Windows
endif
endif
endif

View file

@ -24,12 +24,3 @@ ifndef BASE_IP
BASE_IP := 172.16.1.1
endif
### System dependent Makefile
ifndef WINDIR
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
WINDIR := Windows
endif
endif
endif