Makefiles are entirely reformed to make configuration easier.

This commit is contained in:
matsutsuka 2007-11-28 09:43:01 +00:00
parent 5682272b78
commit b00156d9b0
2 changed files with 72 additions and 65 deletions

View File

@ -2,15 +2,14 @@
# Makefile for PC-6001 using z80/SDCC # Makefile for PC-6001 using z80/SDCC
# @author Takahide Matsutsuka <markn@markn.org> # @author Takahide Matsutsuka <markn@markn.org>
# #
# $Id: Makefile,v 1.3 2007/09/29 04:07:00 matsutsuka Exp $ # $Id: Makefile,v 1.4 2007/11/28 09:43:01 matsutsuka Exp $
# #
CONTIKI = ../.. CONTIKI = ../..
TARGET=pc-6001 TARGET=pc-6001
APPS_DESKTOP = program-handler calc process-list shell about APPS_DESKTOP = program-handler calc process-list shell about
APPS_NETWORK_CLIENT = $(APPS_DESKTOP) netconf webbrowser email telnet ftp irc APPS_NETWORK_CLIENT = $(APPS_DESKTOP) netconf webbrowser email telnet ftp irc
APPS_NETWORK_SERVER = netconf cmdd APPS_NETWORK_SERVER = cmdd telnetd shell www
# editor netconf dhcp webbrowser ftp irc email telnet telnetd # editor netconf dhcp webbrowser ftp irc email telnet telnetd
# cmdd codeprop webserver vnc # cmdd codeprop webserver vnc
# directory # directory
@ -18,46 +17,19 @@ APPS_NETWORK_SERVER = netconf cmdd
PLATFORM_APPS_DESKTOP = multithread tinysample PLATFORM_APPS_DESKTOP = multithread tinysample
PLATFORM_APPS_NETWORK = webserver-mini PLATFORM_APPS_NETWORK = webserver-mini
#defualt values
#16K, 32K, or ROM
MEMORY=32K
#PC6001, PC6001A, or PC6001MK2
ARCH=PC6001
APPS = $(APPS_DESKTOP) APPS = $(APPS_DESKTOP)
PLATFORM_APPS=$(PLATFORM_APPS_DESKTOP) PLATFORM_APPS=$(PLATFORM_APPS_DESKTOP)
all : p6 all : p6
p6: p6 : contiki
rm -f contiki.ihex p62 : contiki
make contiki p6A : contiki
p62: minimal : contiki
rm -f contiki.ihex; serial : contiki
make contiki ARCH=PC6001MK2 rom : contiki.rom
p6A: load : contiki
rm -f contiki.ihex; server : contiki
make contiki ARCH=PC6001A client : contiki
minimal:
rm -f contiki.ihex;
make contiki MEMORY=16K CONTIKI_TARGET_MAIN=contiki-minimal-main.c
serial:
rm -f contiki.ihex;
make contiki MEMORY=32K CONTIKI_TARGET_MAIN=contiki-serial-main.c
rom:
rm -f contiki.ihex;
make contiki.rom MEMORY=ROM CONTIKI_TARGET_MAIN=contiki-rom-main.c
server:
rm -f contiki.ihex;
make contiki APPS="$(APPS_NETWORK_SERVER)" PLATFORM_APPS="$(PLATFORM_APPS_NETWORK)" CONTIKI_TARGET_MAIN=contiki-server-main.c
client:
rm -f contiki.ihex;
make contiki APPS="$(APPS_NETWORK_CLIENT)" PLATFORM_APPS="$(PLATFORM_APPS_NETWORK)" CONTIKI_TARGET_MAIN=contiki-client-main.c
romdump:
rm -f contiki.ihex;
make contiki MEMORY=16K CONTIKI_TARGET_MAIN=romdump.c
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View File

@ -2,44 +2,79 @@
# Makefile for PC-6001 using z80/SDCC # Makefile for PC-6001 using z80/SDCC
# @author Takahide Matsutsuka <markn@markn.org> # @author Takahide Matsutsuka <markn@markn.org>
# #
# $Id: Makefile.pc-6001,v 1.4 2007/09/29 04:07:00 matsutsuka Exp $ # $Id: Makefile.pc-6001,v 1.5 2007/11/28 09:43:01 matsutsuka Exp $
# #
ifndef CONTIKI ifndef CONTIKI
$(error CONTIKI not defined! You must specify where CONTIKI resides!) $(error CONTIKI not defined! You must specify where CONTIKI resides!)
endif endif
### setup default values # Default values
ifndef ARCH
ARCH=PC6001 ARCH=PC6001
endif
ifndef MEMORY
MEMORY=32K MEMORY=32K
endif APPS = $(APPS_DESKTOP)
ifndef HEX2CAS PLATFORM_APPS=$(PLATFORM_APPS_DESKTOP)
HEX2CAS = hex2cas
endif
ifndef CONTIKI_TARGET_MAIN
CONTIKI_TARGET_MAIN = contiki-main.c CONTIKI_TARGET_MAIN = contiki-main.c
CTKCONF = NORMAL
LOADER = 0
# Target dependent options
ifeq ($(MAKECMDGOALS),p62)
ARCH=PC6001MK2
else ifeq ($(MAKECMDGOALS),p6A)
ARCH=PC6001A
else ifeq ($(MAKECMDGOALS),minimal)
MEMORY=16K
CONTIKI_TARGET_MAIN=contiki-minimal-main.c
else ifeq ($(MAKECMDGOALS),serial)
CONTIKI_TARGET_MAIN=contiki-serial-main.c
else ifeq ($(MAKECMDGOALS),rom)
CTKCONF=NOICON
MEMORY=ROM
LOADER = 1
CONTIKI_TARGET_MAIN=contiki-loader-main.c
else ifeq ($(MAKECMDGOALS),load)
CTKCONF=NOICON
LOADER = 1
CONTIKI_TARGET_MAIN=contiki-loader-main.c
else ifeq ($(MAKECMDGOALS),server)
CTKCONF=SERVER APPS="$(APPS_NETWORK_SERVER)"
PLATFORM_APPS="$(PLATFORM_APPS_NETWORK)"
CONTIKI_TARGET_MAIN=contiki-server-main.c
else ifeq ($(MAKECMDGOALS),client)
CTKCONF=CLIENT
APPS="$(APPS_NETWORK_CLIENT)"
PLATFORM_APPS="$(PLATFORM_APPS_NETWORK)"
CONTIKI_TARGET_MAIN=contiki-client-main.c
endif endif
### setup flags to be used in compiler, assembler, and hex2cas ### setup default values
ifndef HEX2BIN
HEX2BIN = hex2cas
endif
### setup flags to be used in compiler, assembler, and HEX2BIN
PLATFORM = $(CONTIKI)/platform/$(TARGET) PLATFORM = $(CONTIKI)/platform/$(TARGET)
CONTIKI_TARGET_DIRS = . ctk dev loader CONTIKI_TARGET_DIRS = . ctk dev loader
CFLAGS += -DMEMORY_$(MEMORY) -DARCH_$(ARCH) CFLAGS += -DMEMORY_$(MEMORY) -DARCH_$(ARCH) -DCTK_$(CTKCONF)
LDFLAGS += #-Wp-includecontiki-conf.h
ifeq ($(MEMORY),16K) ifeq ($(MEMORY),16K)
LDFLAGS += --code-loc 0xc40f --data-loc 0 LDFLAGS += --code-loc 0xc40f --data-loc 0
HEX2CASFLAGS = -1 -n contki -o contiki.p6 HEX2BINFLAGS = -1 -n contki -o contiki.p6
else ifeq ($(MEMORY),ROM) else ifeq ($(MEMORY),ROM)
LDFLAGS += --code-loc 0x4004 --data-loc 0xf000 LDFLAGS += --code-loc 0x4004 --data-loc 0xf000
HEX2CASFLAGS = -r -o contiki.rom HEX2BINFLAGS = -r -o contiki.rom
else ifeq ($(ARCH),PC6001MK2) else ifeq ($(ARCH),PC6001MK2)
LDFLAGS += --code-loc 0x800f --data-loc 0 LDFLAGS += --code-loc 0x800f --data-loc 0
HEX2CASFLAGS = -5 -o contiki2.p6 HEX2BINFLAGS = -5 -o contiki2.p6
else else
LDFLAGS += --code-loc 0x840f --data-loc 0 LDFLAGS += --code-loc 0x840f --data-loc 0
HEX2CASFLAGS = -2 -n contki -o contiki.p6 HEX2BINFLAGS = -2 -n contki -o contiki.p6
endif
ifeq ($(LOADER),1)
CFLAGS += -DWITH_LOADER_ARCH=1
endif endif
### Include platform-depend application makefiles ### Include platform-depend application makefiles
@ -55,7 +90,7 @@ endif
CONTIKI_TARGET_SOURCEFILES = \ CONTIKI_TARGET_SOURCEFILES = \
$(CTK) cfs-ram.c serial.c slip.c \ $(CTK) cfs-ram.c serial.c slip.c \
resolv.c \ resolv.c loader_arch.c \
ctk-conio_arch.c $(CONTIKI_TARGET_MAIN) ctk-conio_arch.c $(CONTIKI_TARGET_MAIN)
#you can use the below instead of ctk-conio_arch.c, ctk-conio_arch-asm.cS, #you can use the below instead of ctk-conio_arch.c, ctk-conio_arch-asm.cS,
@ -63,7 +98,8 @@ CONTIKI_TARGET_SOURCEFILES = \
#ctk-conio_arch-source.c #ctk-conio_arch-source.c
CONTIKI_ASMFILES += getkey.S isprint_arch.S clock.S rs232-asm.S CONTIKI_ASMFILES += getkey.S isprint_arch.S clock.S rs232-asm.S
CONTIKI_CASMFILES += ctk-conio_arch-asm.cS libconio_arch-asm.cS CONTIKI_CASMFILES += ctk-conio_arch-asm.cS libconio_arch-asm.cS\
libconio_arch-small.cS
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
@ -74,9 +110,9 @@ contiki: contiki.p6
.SUFFIXES: .SUFFIXES:
%.p6: %.ihx %.p6: %.ihx
$(HEX2CAS) $(HEX2CASFLAGS) $< $(HEX2BIN) $(HEX2BINFLAGS) $<
%.rom: %.ihx %.rom: %.ihx
$(HEX2CAS) $(HEX2CASFLAGS) $< $(HEX2BIN) $(HEX2BINFLAGS) $<
remove-ctk: remove-ctk:
rm -f obj_$(TARGET)/ctk*; rm -f obj_$(TARGET)/ctk*;
@ -93,6 +129,5 @@ CONTIKI_CPU=$(CONTIKI)/cpu/z80
include $(CONTIKI_CPU)/Makefile.z80 include $(CONTIKI_CPU)/Makefile.z80
### Setup directory search path for source files ### Setup directory search path for source files
PROJECTDIRS += $(PLATFORM_APPDIRS) PROJECTDIRS += $(PLATFORM_APPDIRS)