66 lines
1.7 KiB
Makefile
66 lines
1.7 KiB
Makefile
ifndef CONTIKI
|
|
$(error CONTIKI not defined! You must specify where CONTIKI resides!)
|
|
endif
|
|
|
|
#contiki: contiki-$(TARGET).a
|
|
|
|
CONTIKI_TARGET_DIRS = . net
|
|
CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
|
|
|
|
CONTIKI_TARGET_SOURCEFILES = contiki-main.c dlloader.c clock.c leds.c leds-arch.c
|
|
ifeq ($(OS),Windows_NT)
|
|
CONTIKI_TARGET_SOURCEFILES += wpcap-service.c wpcap.c
|
|
else
|
|
CONTIKI_TARGET_SOURCEFILES += tapdev-service.c tapdev.c
|
|
endif
|
|
|
|
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
|
|
|
.SUFFIXES:
|
|
|
|
### Define the CPU directory
|
|
CONTIKI_CPU=$(CONTIKI)/cpu/x86
|
|
|
|
### Compiler definitions
|
|
CC = gcc
|
|
LD = gcc
|
|
AS = as
|
|
OBJCOPY = objcopy
|
|
STRIP = strip
|
|
CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) \
|
|
-I$(CONTIKI)/platform/$(TARGET) \
|
|
${addprefix -I,$(APPDIRS)} $(APP_INCLUDES) \
|
|
-DWITH_UIP -DWITH_ASCII \
|
|
-Wall -g -I. -I/usr/local/include
|
|
CFLAGS += $(CFLAGSNO)
|
|
LDFLAGS = -Wl,-Map=contiki.map,-export-dynamic
|
|
ifeq ($(OS),Windows_NT)
|
|
TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
|
endif
|
|
|
|
### Setup directory search path for source files
|
|
|
|
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
|
|
$(CONTIKI_TARGET_DIRS)}
|
|
vpath %.c $(PROJECTDIRS) \
|
|
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
|
|
$(CONTIKI_CPU) $(APP_DIRS)
|
|
|
|
### Compilation rules
|
|
|
|
# $(OBJECTDIR)/%.o: %.c
|
|
# $(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
%.so: $(OBJECTDIR)/%.o
|
|
$(LD) -shared -o $@ $^
|
|
|
|
# %.ce: %.co
|
|
# $(LD) -shared -o $@ $^
|
|
|
|
# %.co: %.c
|
|
# $(CC) $(CFLAGS) -DPROCESS_LOADABLE -c $< -o $@
|
|
# $(STRIP) --strip-unneeded -g -x $@
|
|
|
|
# %: %.co $(CONTIKI_TARGET_MAIN) $(PROJECT_OBJECTFILES) contiki-$(TARGET).a
|
|
# $(CC) $(CFLAGS) -o $@.$(TARGET) $^ $(LDFLAGS)
|