mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
@@ -9,10 +9,10 @@ CC_FLAGS = -mmcs51 -I. -Ihttpd -Iuip
|
|||||||
ASM = sdas8051
|
ASM = sdas8051
|
||||||
AFLAGS= -plosgff
|
AFLAGS= -plosgff
|
||||||
|
|
||||||
SUBDIRS := tools uip httpd
|
SUBDIRS := tools
|
||||||
SUBDIRSCLEAN=$(addsuffix clean,$(SUBDIRS))
|
SUBDIRSCLEAN=$(addsuffix clean,$(SUBDIRS))
|
||||||
|
|
||||||
BUILDDIR = output/
|
BUILDDIR = output
|
||||||
VERSION_HEADER := version.h
|
VERSION_HEADER := version.h
|
||||||
|
|
||||||
ifeq ($(MACHINE),)
|
ifeq ($(MACHINE),)
|
||||||
@@ -20,18 +20,23 @@ else
|
|||||||
CC_FLAGS += -DMACHINE_$(MACHINE)
|
CC_FLAGS += -DMACHINE_$(MACHINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: create_build_dir $(VERSION_HEADER) $(SUBDIRS) $(BUILDDIR)rtlplayground.bin
|
all: create_build_dir $(VERSION_HEADER) $(SUBDIRS) $(BUILDDIR)/rtlplayground.bin
|
||||||
|
|
||||||
create_build_dir:
|
create_build_dir:
|
||||||
mkdir -p $(BUILDDIR)
|
mkdir -p $(BUILDDIR)
|
||||||
|
mkdir -p $(BUILDDIR)/uip
|
||||||
|
mkdir -p $(BUILDDIR)/httpd
|
||||||
|
|
||||||
SRCS = rtlplayground.c rtl837x_flash.c rtl837x_leds.c rtl837x_phy.c rtl837x_port.c cmd_parser.c html_data.c rtl837x_igmp.c \
|
SRCS = rtlplayground.c rtl837x_flash.c rtl837x_leds.c rtl837x_phy.c rtl837x_port.c cmd_parser.c html_data.c rtl837x_igmp.c
|
||||||
rtl837x_stp.c rtl837x_pins.c dhcp.c machine.c cmd_editor.c rtl837x_bandwidth.c
|
SRCS += rtl837x_stp.c rtl837x_pins.c dhcp.c machine.c cmd_editor.c rtl837x_bandwidth.c
|
||||||
OBJS = ${SRCS:%.c=$(BUILDDIR)%.rel}
|
SRCS += uip/timer.c uip/uip.c uip/uip_arp.c uip/uiplib.c uip/uip-fw.c uip/uip-neighbor.c uip/uip-split.c
|
||||||
OBJS += uip/$(BUILDDIR)/timer.rel uip/$(BUILDDIR)/uip-fw.rel uip/$(BUILDDIR)/uip-neighbor.rel uip/$(BUILDDIR)/uip-split.rel uip/$(BUILDDIR)/uip.rel uip/$(BUILDDIR)/uip_arp.rel uip/$(BUILDDIR)/uiplib.rel httpd/$(BUILDDIR)/httpd.rel httpd/$(BUILDDIR)/page_impl.rel
|
SRCS += httpd/httpd.c httpd/page_impl.c
|
||||||
|
OBJS = ${SRCS:%.c=$(BUILDDIR)/%.rel}
|
||||||
|
DEPS := ${SRCS:%.c=$(BUILDDIR)/%.d}
|
||||||
|
HTML := $(shell find $(html) -name '*.js' -or -name '*.html' -or -name '*.svg')
|
||||||
|
|
||||||
html_data.c html_data.h: html tools
|
html_data.c html_data.h: $(HTML) tools/$(BUILDDIR)/fileadder
|
||||||
tools/$(BUILDDIR)fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -d html -p html_data
|
tools/$(BUILDDIR)/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -d html -p html_data
|
||||||
|
|
||||||
$(VERSION_HEADER):
|
$(VERSION_HEADER):
|
||||||
@echo "#ifndef VERSION_H" > $(VERSION_HEADER)
|
@echo "#ifndef VERSION_H" > $(VERSION_HEADER)
|
||||||
@@ -46,37 +51,31 @@ $(SUBDIRS):
|
|||||||
$(MAKE) -C $@
|
$(MAKE) -C $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-make -C uip clean
|
-rm -f html_data.c html_data.h $(VERSION_HEADER)
|
||||||
-make -C httpd clean
|
-rm -rf $(BUILDDIR)
|
||||||
-rm html_data.c html_data.h $(VERSION_HEADER)
|
|
||||||
-rm -r $(BUILDDIR)
|
|
||||||
|
|
||||||
$(BUILDDIR)crtstart.rel: crtstart.asm
|
$(BUILDDIR)/%.rel: %.c
|
||||||
$(ASM) $(AFLAGS) -o $@ $<
|
$(CC) -MMD $(CC_FLAGS) -o $@ -c $<
|
||||||
|
|
||||||
$(BUILDDIR)crc16.rel: crc16.asm
|
$(BUILDDIR)/%.rel: %.asm
|
||||||
$(ASM) $(AFLAGS) -o $@ $<
|
|
||||||
|
|
||||||
$(BUILDDIR)%.rel: %.c
|
|
||||||
$(CC) $(CC_FLAGS) -o $@ -c $<
|
|
||||||
|
|
||||||
$(BUILDDIR)%.rel: $(BUILDDIR)%.asm
|
|
||||||
${ASM} ${AFLAGS} -o $@ $<
|
${ASM} ${AFLAGS} -o $@ $<
|
||||||
# mv -f $(addprefix $(basename $^), .lst .rel .sym) .
|
# mv -f $(addprefix $(basename $^), .lst .rel .sym) .
|
||||||
|
|
||||||
$(BUILDDIR)rtlplayground.ihx: $(OBJS) $(BUILDDIR)crtstart.rel $(BUILDDIR)crc16.rel
|
$(BUILDDIR)/rtlplayground.ihx: $(OBJS) $(BUILDDIR)/crtstart.rel $(BUILDDIR)/crc16.rel
|
||||||
$(CC) $(CC_FLAGS) -Wl-bHOME=0x00000 -Wl-bBANK1=0x14000 -Wl-bBANK2=0x24000 -Wl-r -o $@ $^
|
$(CC) $(CC_FLAGS) -Wl-bHOME=0x00000 -Wl-bBANK1=0x14000 -Wl-bBANK2=0x24000 -Wl-r -o $@ $^
|
||||||
|
|
||||||
$(BUILDDIR)rtlplayground.img: $(BUILDDIR)rtlplayground.ihx
|
$(BUILDDIR)/rtlplayground.img: $(BUILDDIR)/rtlplayground.ihx
|
||||||
objcopy --input-target=ihex -O binary $< $@
|
objcopy --input-target=ihex -O binary $< $@
|
||||||
|
|
||||||
$(BUILDDIR)rtlplayground.bin: $(BUILDDIR)rtlplayground.img
|
$(BUILDDIR)/rtlplayground.bin: $(BUILDDIR)/rtlplayground.img
|
||||||
if [ -e $@ ]; then rm $@; fi
|
if [ -e $@ ]; then rm $@; fi
|
||||||
tools/$(BUILDDIR)imagebuilder -i $^ $@
|
tools/$(BUILDDIR)/imagebuilder -i $^ $@
|
||||||
tools/$(BUILDDIR)fileadder -a $(DEFAULT_CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
|
tools/$(BUILDDIR)/fileadder -a $(DEFAULT_CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
|
||||||
tools/$(BUILDDIR)fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
|
tools/$(BUILDDIR)/fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
|
||||||
tools/$(BUILDDIR)fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -d html -p html_data $@
|
tools/$(BUILDDIR)/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -d html -p html_data $@
|
||||||
tools/$(BUILDDIR)crc_calculator -u $@
|
tools/$(BUILDDIR)/crc_calculator -u $@
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean all $(SUBDIRS)
|
.PHONY: clean all $(SUBDIRS) $(VERSION_HEADER)
|
||||||
|
|
||||||
|
-include $(DEPS)
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
CC = sdcc
|
|
||||||
CC_FLAGS = -mmcs51 -I. -I.. -I../uip
|
|
||||||
ASM = sdas8051
|
|
||||||
AFLAGS= -plosgff
|
|
||||||
|
|
||||||
BUILDDIR = output/
|
|
||||||
|
|
||||||
SRCS = httpd.c page_impl.c
|
|
||||||
OBJS = ${SRCS:%.c=$(BUILDDIR)%.rel}
|
|
||||||
|
|
||||||
all: create_build_dir $(OBJS)
|
|
||||||
|
|
||||||
create_build_dir:
|
|
||||||
mkdir -p $(BUILDDIR)
|
|
||||||
|
|
||||||
$(BUILDDIR)%.asm: %.c
|
|
||||||
$(CC) $(CC_FLAGS) -o $@ -c -S $<
|
|
||||||
|
|
||||||
$(BUILDDIR)%.rel: $(BUILDDIR)%.asm
|
|
||||||
${ASM} ${AFLAGS} -o $@ $^
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -r $(BUILDDIR)
|
|
||||||
|
|
||||||
.PHONY: all clean
|
|
||||||
|
|
||||||
+9
-9
@@ -1,27 +1,27 @@
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CCFLAGS = -Wall -o
|
CCFLAGS = -Wall -o
|
||||||
BUILDDIR = output/
|
BUILDDIR = output
|
||||||
|
|
||||||
all: create_build_dir $(BUILDDIR)injector $(BUILDDIR)fileadder $(BUILDDIR)httpd_sim\
|
all: create_build_dir $(BUILDDIR)/injector $(BUILDDIR)/fileadder $(BUILDDIR)/httpd_sim\
|
||||||
$(BUILDDIR)crc_calculator $(BUILDDIR)imagebuilder
|
$(BUILDDIR)/crc_calculator $(BUILDDIR)/imagebuilder
|
||||||
|
|
||||||
create_build_dir:
|
create_build_dir:
|
||||||
mkdir -p $(BUILDDIR)
|
mkdir -p $(BUILDDIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -r $(BUILDDIR)
|
rm -rf $(BUILDDIR)
|
||||||
|
|
||||||
$(BUILDDIR)injector: injector.c
|
$(BUILDDIR)/injector: injector.c
|
||||||
gcc $^ $(CCFLAGS) $@
|
gcc $^ $(CCFLAGS) $@
|
||||||
|
|
||||||
$(BUILDDIR)fileadder: fileadder.c
|
$(BUILDDIR)/fileadder: fileadder.c
|
||||||
gcc $^ $(CCFLAGS) $@
|
gcc $^ $(CCFLAGS) $@
|
||||||
|
|
||||||
$(BUILDDIR)crc_calculator: crc_calculator.c
|
$(BUILDDIR)/crc_calculator: crc_calculator.c
|
||||||
gcc $^ $(CCFLAGS) $@
|
gcc $^ $(CCFLAGS) $@
|
||||||
|
|
||||||
$(BUILDDIR)httpd_sim: httpd_sim.c httpd_sim.h
|
$(BUILDDIR)/httpd_sim: httpd_sim.c httpd_sim.h
|
||||||
gcc $< $(CCFLAGS) $@ -I/usr/include/json-c -ljson-c
|
gcc $< $(CCFLAGS) $@ -I/usr/include/json-c -ljson-c
|
||||||
|
|
||||||
$(BUILDDIR)imagebuilder: imagebuilder.c
|
$(BUILDDIR)/imagebuilder: imagebuilder.c
|
||||||
gcc $^ $(CCFLAGS) $@
|
gcc $^ $(CCFLAGS) $@
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
CC = sdcc
|
|
||||||
CC_FLAGS = -mmcs51 -I. -I.. -I../httpd
|
|
||||||
ASM = sdas8051
|
|
||||||
AFLAGS= -plosgff
|
|
||||||
|
|
||||||
BUILDDIR = output/
|
|
||||||
|
|
||||||
SRCS = timer.c uip_arp.c uip.c uip-fw.c uiplib.c uip-neighbor.c uip-split.c
|
|
||||||
OBJS = ${SRCS:%.c=$(BUILDDIR)%.rel}
|
|
||||||
|
|
||||||
all: create_build_dir $(OBJS)
|
|
||||||
|
|
||||||
create_build_dir:
|
|
||||||
mkdir -p $(BUILDDIR)
|
|
||||||
|
|
||||||
$(BUILDDIR)%.rel: %.c
|
|
||||||
$(CC) $(CC_FLAGS) -o $@ -c $<
|
|
||||||
|
|
||||||
$(BUILDDIR)%.rel: $(BUILDDIR)%.asm
|
|
||||||
${ASM} ${AFLAGS} $^
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -r $(BUILDDIR)
|
|
||||||
|
|
||||||
.PHONY: all clean
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user