Simplified host OS platform detection in Makefiles
This commit is contained in:
parent
745f071c98
commit
9c99d46e24
17 changed files with 66 additions and 134 deletions
|
@ -21,6 +21,15 @@ ifeq ($(DEFINES),)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef HOST_OS
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
$(warning Windows (NT) deteced.)
|
||||||
|
HOST_OS := Windows
|
||||||
|
else
|
||||||
|
HOST_OS := $(shell uname)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
@echo "make MAKETARGETS... [TARGET=(TARGET)] [savetarget] [targets]"
|
@echo "make MAKETARGETS... [TARGET=(TARGET)] [savetarget] [targets]"
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
# $Id: Makefile.avr,v 1.27 2010/12/22 21:13:09 dak664 Exp $
|
# $Id: Makefile.avr,v 1.27 2010/12/22 21:13:09 dak664 Exp $
|
||||||
|
|
||||||
### Check if we are running under Windows
|
|
||||||
|
|
||||||
ifndef WINDIR
|
|
||||||
ifdef OS
|
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
WINDIR := Windows
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
|
||||||
### Optimization setting. $make OPTI=0 for easier debugging of changed source file(s)
|
### Optimization setting. $make OPTI=0 for easier debugging of changed source file(s)
|
||||||
|
|
|
@ -72,8 +72,7 @@ CUSTOM_RULE_C_TO_O=yes
|
||||||
CFLAGS += -I$(OBJECTDIR) -I$(CONTIKI_CPU)/board -DBOARD=$(TARGET)
|
CFLAGS += -I$(OBJECTDIR) -I$(CONTIKI_CPU)/board -DBOARD=$(TARGET)
|
||||||
|
|
||||||
$(OBJECTDIR)/board.h: $(OBJECTDIR)
|
$(OBJECTDIR)/board.h: $(OBJECTDIR)
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
ifeq ($(HOST_OS),Windows)
|
||||||
${info Cygwin detected.}
|
|
||||||
ln -f $(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h
|
ln -f $(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h
|
||||||
else
|
else
|
||||||
ln -sf ../$(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h
|
ln -sf ../$(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h
|
||||||
|
|
|
@ -166,11 +166,9 @@ endif
|
||||||
FLASHER = $(CONTIKI)/tools/stm32w/stm32w_flasher/stm32w_flasher
|
FLASHER = $(CONTIKI)/tools/stm32w/stm32w_flasher/stm32w_flasher
|
||||||
|
|
||||||
# Check if we are running under Windows
|
# Check if we are running under Windows
|
||||||
ifdef OS
|
ifeq ($(HOST_OS),Windows)
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
FLASHER = $(CONTIKI)/tools/stm32w/stm32w_flasher/stm32w_flasher.exe
|
FLASHER = $(CONTIKI)/tools/stm32w/stm32w_flasher/stm32w_flasher.exe
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
ifndef PORT
|
ifndef PORT
|
||||||
|
|
|
@ -13,7 +13,7 @@ export doclatex := NO
|
||||||
export docroot := ../
|
export docroot := ../
|
||||||
|
|
||||||
# Get appropriate root for doxygen path cutoff
|
# Get appropriate root for doxygen path cutoff
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
ifeq ($(HOST_OS),Windows)
|
||||||
# on windows need to convert cygwin path to windows path for doxygen
|
# on windows need to convert cygwin path to windows path for doxygen
|
||||||
ifneq (,$(findstring cygdrive,$(pwd)))
|
ifneq (,$(findstring cygdrive,$(pwd)))
|
||||||
cygroot = $(subst /,$(space),$(patsubst /cygdrive/%,%,$(pwd)))
|
cygroot = $(subst /,$(space),$(patsubst /cygdrive/%,%,$(pwd)))
|
||||||
|
|
|
@ -11,14 +11,6 @@ ifndef CONTIKI
|
||||||
$(error CONTIKI not defined!)
|
$(error CONTIKI not defined!)
|
||||||
endif
|
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
|
### Assuming simulator quickstart if no JNI library name set from Cooja
|
||||||
ifndef LIBNAME
|
ifndef LIBNAME
|
||||||
QUICKSTART=1
|
QUICKSTART=1
|
||||||
|
|
|
@ -68,23 +68,15 @@ send: $(CONTIKI)/tools/codeprop.c
|
||||||
|
|
||||||
### System dependent Makefile
|
### System dependent Makefile
|
||||||
|
|
||||||
ifndef WINDIR
|
ifeq ($(HOST_OS),FreeBSD)
|
||||||
ifdef OS
|
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
WINDIR := Windows
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (${HOSTTYPE},FreeBSD)
|
|
||||||
# settings for FreeBSD
|
# settings for FreeBSD
|
||||||
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd
|
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd
|
||||||
else
|
else
|
||||||
ifndef WINDIR
|
ifeq ($(HOST_OS),Windows)
|
||||||
# settings for unix
|
# settings for Windows
|
||||||
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix
|
|
||||||
else
|
|
||||||
# settings for windows
|
|
||||||
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win
|
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win
|
||||||
|
else
|
||||||
|
# settings for an arbitary unix-like platform
|
||||||
|
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -31,23 +31,15 @@ include $(CONTIKIAVR)/Makefile.avr
|
||||||
avr-objdump -zhD $< > $@
|
avr-objdump -zhD $< > $@
|
||||||
|
|
||||||
|
|
||||||
ifndef WINDIR
|
|
||||||
ifdef OS
|
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
WINDIR := Windows
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(PRGBOARD), )
|
ifeq ($(PRGBOARD), )
|
||||||
PRGBOARD = mib510
|
PRGBOARD = mib510
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PORT), )
|
ifeq ($(PORT), )
|
||||||
ifndef WINDIR
|
ifeq ($(HOST_OS), Windows)
|
||||||
PORT = /dev/ttyUSB0
|
|
||||||
else
|
|
||||||
PORT = COM1
|
PORT = COM1
|
||||||
|
else
|
||||||
|
PORT = /dev/ttyUSB0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,9 @@ include $(CONTIKI)/cpu/stm32w108/Makefile.stm32w108
|
||||||
|
|
||||||
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-linux
|
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-linux
|
||||||
|
|
||||||
ifdef OS
|
ifeq ($(HOST_OS),Windows)
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows
|
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,9 @@ include $(CONTIKI)/cpu/stm32w108/Makefile.stm32w108
|
||||||
|
|
||||||
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-linux
|
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-linux
|
||||||
|
|
||||||
ifdef OS
|
ifeq ($(HOST_OS),Windows)
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows
|
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,23 +26,15 @@ include $(CONTIKIAVR)/Makefile.avr
|
||||||
avr-objdump -zhD $< > $@
|
avr-objdump -zhD $< > $@
|
||||||
|
|
||||||
|
|
||||||
ifndef WINDIR
|
|
||||||
ifdef OS
|
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
WINDIR := Windows
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(PRGBOARD), )
|
ifeq ($(PRGBOARD), )
|
||||||
PRGBOARD = mib510
|
PRGBOARD = mib510
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PORT), )
|
ifeq ($(PORT), )
|
||||||
ifndef WINDIR
|
ifeq ($(HOST_OS),Windows)
|
||||||
PORT = /dev/ttyS0
|
|
||||||
else
|
|
||||||
PORT = COM1
|
PORT = COM1
|
||||||
|
else
|
||||||
|
PORT = /dev/ttyS0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -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
|
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
|
CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c
|
||||||
else
|
else
|
||||||
CONTIKI_TARGET_SOURCEFILES += tapdev-drv.c
|
CONTIKI_TARGET_SOURCEFILES += tapdev-drv.c
|
||||||
|
@ -21,7 +21,7 @@ endif
|
||||||
|
|
||||||
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(HOST_OS),Windows)
|
||||||
TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -24,24 +24,16 @@ endif
|
||||||
|
|
||||||
### System dependent Makefile
|
### System dependent Makefile
|
||||||
|
|
||||||
ifndef WINDIR
|
ifeq ($(HOST_OS),FreeBSD)
|
||||||
ifdef OS
|
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
WINDIR := Windows
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (${HOSTTYPE},FreeBSD)
|
|
||||||
# settings for FreeBSD
|
# settings for FreeBSD
|
||||||
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd
|
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd
|
||||||
else
|
else
|
||||||
ifndef WINDIR
|
ifeq ($(HOST_OS),Windows)
|
||||||
# settings for unix
|
# settings for Windows
|
||||||
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix
|
|
||||||
else
|
|
||||||
# settings for windows
|
|
||||||
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win
|
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win
|
||||||
|
else
|
||||||
|
# settings for an arbitary unix-like platform
|
||||||
|
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -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 \
|
button-sensor.c pir-sensor.c vib-sensor.c xmem.c \
|
||||||
sensors.c irq.c cfs-posix.c cfs-posix-dir.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
|
CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c
|
||||||
TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
||||||
else
|
else
|
||||||
|
|
|
@ -43,8 +43,7 @@ NUMPAR=20
|
||||||
IHEXFILE=tmpimage.ihex
|
IHEXFILE=tmpimage.ihex
|
||||||
|
|
||||||
# Check if we are running under Windows
|
# Check if we are running under Windows
|
||||||
ifdef OS
|
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
USBDEVPREFIX=/dev/com
|
USBDEVPREFIX=/dev/com
|
||||||
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-windows
|
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-windows
|
||||||
MOTELIST = $(CONTIKI)/tools/sky/motelist-windows
|
MOTELIST = $(CONTIKI)/tools/sky/motelist-windows
|
||||||
|
@ -66,7 +65,6 @@ ifdef OS
|
||||||
cut -f 4 -d \ | \
|
cut -f 4 -d \ | \
|
||||||
perl -ne 'print $$1 . " " if(/COM(\d+)/);')
|
perl -ne 'print $$1 . " " if(/COM(\d+)/);')
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
# If we are not running under Windows, we assume Linux
|
# If we are not running under Windows, we assume Linux
|
||||||
ifndef MOTELIST
|
ifndef MOTELIST
|
||||||
|
|
|
@ -27,12 +27,3 @@ ifndef BASE_IP
|
||||||
BASE_IP := 172.16.1.1
|
BASE_IP := 172.16.1.1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
### System dependent Makefile
|
|
||||||
|
|
||||||
ifndef WINDIR
|
|
||||||
ifdef OS
|
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
WINDIR := Windows
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
|
@ -24,12 +24,3 @@ ifndef BASE_IP
|
||||||
BASE_IP := 172.16.1.1
|
BASE_IP := 172.16.1.1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
### System dependent Makefile
|
|
||||||
|
|
||||||
ifndef WINDIR
|
|
||||||
ifdef OS
|
|
||||||
ifneq (,$(findstring Windows,$(OS)))
|
|
||||||
WINDIR := Windows
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue