9d4fc0a1a8
In order to support, some core modules are modified as follows: core/sys/dsc.h - If CTK_CONF_ICONS is diabled, the whole icon-related code is disabled. - DSC_HEADER is changed to remove extra semicolon. core/sys/process.h - process_data_t is expressed by void* in signatures (known bug on sdcc). core/sys/autostart.h - autostart_processes is changed to remove extra semicolon. core/sys/cc.h - CC_CONF_ASSIGN_AGGREGATE is introduced. - CC_CONF_INC_CAST_POINTER is introduced, a workaround of a kind of sdcc bug for an increment. core/net/hc.c core/net/uip_arp.c core/net/uaodv.c - Aggregation assignments are changed to uip_ipaddr_copy. core/net/psock.c core/net/uipbuf.c core/net/dhcpc.c apps/shell/shell.c core/ctk/vnc-server.c core/ctk/vnc-out.c - "register" keyword in a signature cannot be used in sdcc, CC_REGISTER_ARG is used instead. core/net/uip-over-mesh.c - An extra semicolon is removed. apps/dhcp/dhcp-dsc.c apps/shell/shell-dsc. apps/ftp/ftp-dsc.c apps/process-list/process-list-dsc.c apps/email/email-dsc.c apps/webserver/webserver-dsc.c apps/vnc/vnc-dsc.c apps/vnc/vnc-viewer.h apps/webbrowser/www-dsc.c apps/about/about-dsc.c apps/irc/irc-dsc.c apps/telnet/telnet-dsc.c apps/telnetd/telnetd-dsc.c apps/netconf/netconf-dsc.c apps/directory/directory-dsc.c pps/calc/calc-dsc.c - Modify an extern type to a real declaration, which is static to prevent a compile error. core/net/mac/xmac.c - Variables cannot be defined in a head of block on sdcc. core/ctk/ctk.h core/ctk/ctk.c apps/program-handler/program-handler.c - If CTK_CONF_ICONS is diabled, the whole icon-related code is disabled. Makefile.include - Add a set of configuration for an assembler. - $(CLEAN) variable is introduced for customized cleanup. apps/process-list/process-list.c - PROCESSLIST_CONF_HEIGHT is introduced to address smaller screen size. core/lib/ctk-filedialog.c - FILES_CONF_HEIGHT is introduced to address smaller screen size. - "register" keyword in a signature cannot be used in sdcc, CC_REGISTER_ARG is used instead. apps/vnc/vnc-viewer.c - A cast is added to prevent a compile error. - "register" keyword in a signature cannot be used in sdcc, CC_REGISTER_ARG is used instead. apps/webbrowser/webclient.c - CC_CONF_INC_CAST_POINTER is introduced, a workaround of a kind of sdcc bug for an increment. core/loader/elfloader.c - A cast is added to prevent a compile error. core/net/rime/rimeaddr.c - An initialization is added to prevent a compile error. core/net/rime/rudolph0.c - NULL is changed to 0, because NULL causes a compile error. core/net/rime/route-discovery.c - Add an argument to match the definition of nf_callbacks. cpu/z80/strcasecmp.h cpu/z80/strcasecmp.c cpu/z80/contiki-sdcc-conf.h cpu/z80/mtarch.c cpu/z80/mtarch.h cpu/z80/Makefile.z80 - New files to make compilation availble on sdcc. - Added support for multithreading.
186 lines
5 KiB
Makefile
186 lines
5 KiB
Makefile
ifndef CONTIKI
|
|
${error CONTIKI not defined! You must specify where CONTIKI resides!}
|
|
endif
|
|
|
|
OBJECTDIR = obj_$(TARGET)
|
|
CFLAGS += -DCONTIKI_TARGET=$(TARGET)
|
|
|
|
ifeq ($(TARGET),)
|
|
-include Makefile.target
|
|
ifeq ($(TARGET),)
|
|
ifeq ($(DEFAULT_TARGET),)
|
|
DEFAULT_TARGET=native
|
|
endif
|
|
${warning TARGET not defined, using target '$(DEFAULT_TARGET)'}
|
|
TARGET=$(DEFAULT_TARGET)
|
|
else
|
|
${warning using saved target '$(TARGET)'}
|
|
endif
|
|
endif
|
|
|
|
usage:
|
|
@echo "make MAKETARGETS... [TARGET=(TARGET)] [savetarget] [targets]"
|
|
|
|
targets:
|
|
@ls -1 $(CONTIKI)/platform | grep -v CVS
|
|
|
|
savetarget:
|
|
-@rm -f Makefile.target
|
|
@echo >Makefile.target "TARGET = $(TARGET)"
|
|
|
|
ifeq (${wildcard $(OBJECTDIR)},)
|
|
DUMMY := ${shell mkdir $(OBJECTDIR)}
|
|
endif
|
|
|
|
include $(CONTIKI)/core/net/rime/Makefile.rime
|
|
ifdef CHAMELEON
|
|
include $(CONTIKI)/core/net/chameleon/Makefile.chameleon
|
|
endif
|
|
include $(CONTIKI)/core/net/mac/Makefile.mac
|
|
SYSTEM = process.c procinit.c autostart.c elfloader.c
|
|
THREADS = mt.c
|
|
LIBS = memb.c timer.c list.c etimer.c energest.c rtimer.c
|
|
CTK = ctk.c
|
|
UIP = uip.c uiplib.c resolv.c tcpip.c psock.c hc.c uip-split.c \
|
|
uip-fw.c uip-fw-drv.c uipbuf.c uip_arp.c uiplib.c tcpdump.c \
|
|
uip-neighbor.c uip-udp-packet.c rawpacket-udp.c uip-over-mesh.c
|
|
NET = $(UIP) uaodv.c uaodv-rt.c
|
|
|
|
CTKVNC = $(CTK) ctk-vncserver.c libconio.c vnc-server.c vnc-out.c \
|
|
ctk-vncfont.c
|
|
CTKTERM = $(CTK) libconio.c ctk-term.c ctk-term-in.c ctk-term-out.c \
|
|
ctk-termtelnet.c
|
|
|
|
CONTIKIFILES = $(SYSTEM) $(LIBS) $(NET) $(DHCP) $(THREADS)
|
|
|
|
CONTIKI_SOURCEFILES += $(CONTIKIFILES)
|
|
|
|
CONTIKIDIRS += ${addprefix $(CONTIKI)/core/,dev lib net net/mac net/rime sys \
|
|
cfs ctk lib/ctk loader . }
|
|
|
|
oname = ${patsubst %.c,%.o,${patsubst %.S,%.o,$(1)}}
|
|
|
|
CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFILES)}}
|
|
|
|
PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}}
|
|
|
|
CONTIKI_ASMOBJECTFILES = ${addprefix $(OBJECTDIR)/,$(CONTIKI_ASMFILES:.S=.o)}
|
|
|
|
### Include application makefiles
|
|
|
|
ifdef APPS
|
|
APPDIRS += ${addprefix $(CONTIKI)/apps/, $(APPS)}
|
|
APPINCLUDES = ${foreach APP, $(APPS), $(CONTIKI)/apps/$(APP)/Makefile.$(APP)}
|
|
-include $(APPINCLUDES)
|
|
APP_SOURCES = ${foreach APP, $(APPS), $($(APP)_src)}
|
|
DSC_SOURCES = ${foreach APP, $(APPS), $($(APP)_dsc)}
|
|
CONTIKI_SOURCEFILES += $(APP_SOURCES) $(DSC_SOURCES)
|
|
endif
|
|
|
|
### Include target makefile (TODO Unsafe?)
|
|
|
|
include $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET)
|
|
|
|
### Setup directory search path for source and header files
|
|
|
|
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
|
|
$(CONTIKI_TARGET_DIRS)}
|
|
CONTIKI_CPU_DIRS_CONCAT = ${addprefix $(CONTIKI_CPU)/, \
|
|
$(CONTIKI_CPU_DIRS)}
|
|
|
|
SOURCEDIRS = $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
|
|
$(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(APPDIRS)
|
|
|
|
vpath %.c $(SOURCEDIRS)
|
|
vpath %.S $(SOURCEDIRS)
|
|
|
|
CFLAGS += ${addprefix -I,$(SOURCEDIRS)}
|
|
|
|
### Automatic dependency generation
|
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
|
-include ${addprefix $(OBJECTDIR)/,$(CONTIKI_SOURCEFILES:.c=.d) \
|
|
$(PROJECT_SOURCEFILES:.c=.d)}
|
|
endif
|
|
|
|
clean:
|
|
rm -f *~ *core core *.srec \
|
|
*.lst *.map \
|
|
*.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \
|
|
*.ce *.co $(CLEAN)
|
|
-rm -rf $(OBJECTDIR)
|
|
|
|
ifndef CUSTOM_RULE_C_TO_CE
|
|
%.ce: %.c
|
|
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE -c $< -o $@
|
|
$(STRIP) --strip-unneeded -g -x $@
|
|
endif
|
|
|
|
ifndef CUSTOM_RULE_C_TO_OBJECTDIR_O
|
|
$(OBJECTDIR)/%.o: %.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
endif
|
|
|
|
ifndef CUSTOM_RULE_C_TO_O
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
endif
|
|
|
|
ifndef CUSTOM_RULE_C_TO_CO
|
|
%.co: %.c
|
|
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE -c $< -o $@
|
|
endif
|
|
|
|
ifndef CUSTOM_RULE_S_TO_OBJECTDIR_O
|
|
$(OBJECTDIR)/%.o: %.S
|
|
$(AS) $(ASFLAGS) -o $@ $<
|
|
endif
|
|
|
|
ifndef AROPTS
|
|
AROPTS = rcf
|
|
endif
|
|
|
|
ifndef CUSTOM_RULE_ALLOBJS_TO_TARGETLIB
|
|
contiki-$(TARGET).a: $(CONTIKI_OBJECTFILES)
|
|
$(AR) $(AROPTS) $@ $^
|
|
endif
|
|
|
|
ifndef CCDEP
|
|
CCDEP = $(CC)
|
|
endif
|
|
ifndef CDEPFLAGS
|
|
CDEPFLAGS = $(CFLAGS)
|
|
endif
|
|
|
|
ifndef CUSTOM_RULE_C_TO_OBJECTDIR_D
|
|
$(OBJECTDIR)/%.d: %.c
|
|
@echo Making dependencies for $<; set -e; rm -f $@; \
|
|
$(CCDEP) -MM $(CDEPFLAGS) $< > $@.$$$$; \
|
|
sed 's,\($*\)\.o[ :]*,$(OBJECTDIR)/\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
rm -f $@.$$$$
|
|
endif
|
|
|
|
ifndef LD
|
|
LD = $(CC)
|
|
endif
|
|
|
|
ifndef CUSTOM_RULE_LINK
|
|
%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
|
|
$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@
|
|
endif
|
|
|
|
# Don't treat %.$(TARGET) as an intermediate file because it is
|
|
# in fact the primary target.
|
|
.PRECIOUS: %.$(TARGET)
|
|
|
|
# Cancel the predefined implict rule for compiling and linking
|
|
# a single C source into a binary to force GNU make to consider
|
|
# the match-anything rule below instead.
|
|
%: %.c
|
|
|
|
# Match-anything pattern rule to allow the project makefiles to
|
|
# abstract from the actual binary name. It needs to contain some
|
|
# command in order to be a rule, not just a prerequisite.
|
|
%: %.$(TARGET)
|
|
@
|