From 432d9d77de21069878a74c48cd6434b1dae7b18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= Date: Sat, 27 Sep 2025 12:38:06 +0200 Subject: [PATCH] build: uip: also declutter sourcecode --- Makefile | 2 +- uip/Makefile | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index baf1962..107c41a 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ create_build_dir: SRCS = rtlplayground.c rtl837x_flash.c rtl837x_phy.c rtl837x_port.c cmd_parser.c html_data.c rtl837x_igmp.c rtl837x_stp.c OBJS = ${SRCS:%.c=$(BUILDDIR)%.rel} -OBJS += uip/timer.rel uip/uip-fw.rel uip/uip-neighbor.rel uip/uip-split.rel uip/uip.rel uip/uip_arp.rel uip/uiplib.rel httpd/$(BUILDDIR)/httpd.rel httpd/$(BUILDDIR)/page_impl.rel +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 html_data.c html_data.h: html tools tools/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -d html -p html_data diff --git a/uip/Makefile b/uip/Makefile index 7a9ef28..17c232c 100644 --- a/uip/Makefile +++ b/uip/Makefile @@ -3,19 +3,24 @@ CC_FLAGS = -mmcs51 -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=.rel} +OBJS = ${SRCS:%.c=$(BUILDDIR)%.rel} -all: $(OBJS) +all: create_build_dir $(OBJS) -%.rel: %.c - $(CC) $(CC_FLAGS) -c $< +create_build_dir: + mkdir -p $(BUILDDIR) -%.rel: %.asm +$(BUILDDIR)%.rel: %.c + $(CC) $(CC_FLAGS) -o $@ -c $< + +$(BUILDDIR)%.rel: $(BUILDDIR)%.asm ${ASM} ${AFLAGS} $^ clean: - rm *.ihx *.lk *.lst *.map *.mem *.rel *.rst *.sym *.bin + rm -r $(BUILDDIR) .PHONY: all clean