From fc9d89eff27eac6569c25c8d5f55992e5db40eae Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 3 Sep 2015 12:08:32 -0700 Subject: [PATCH] Kconfig: use PARAM for all options. --- sys/pic32/Makefile.kconf | 19 +++++--------- sys/pic32/max32/Makefile | 51 ++++++++++++++++++++++++++------------ tools/kconfig/config.h | 1 - tools/kconfig/mkmakefile.c | 37 ++++++++++++++------------- 4 files changed, 61 insertions(+), 47 deletions(-) diff --git a/sys/pic32/Makefile.kconf b/sys/pic32/Makefile.kconf index e302854..812a1f0 100644 --- a/sys/pic32/Makefile.kconf +++ b/sys/pic32/Makefile.kconf @@ -21,14 +21,14 @@ endif # sources are located via $S relative to the compilation directory S = ../.. -COPTS = -I. ${IDENT} -DKERNEL -CFLAGS = -O ${COPTS} ${PARAM} +DEFS = -I. ${PARAM} -DKERNEL +CFLAGS = -O ${DEFS} # compile rules: rules are named COMPILE_${SUFFIX} # SUFFIX is the file suffix, capitalized (e.g. C for a .c file). COMPILE_C = ${CC} -c ${CFLAGS} $< -COMPILE_S = ${CC} -c ${COPTS} $< +COMPILE_S = ${CC} -c ${DEFS} $< %OBJS @@ -67,23 +67,16 @@ reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig load: unix.elf pic32prog unix.hex -startup.o: ../startup.S - ${COMPILE_S} - -# the following are necessary because the files depend on the types of -# cpu's included in the system configuration -clock.o machdep.o conf.o: Makefile - machine: ln -s .. $@ sys: ln -s ../../include $@ -depend: machine - mkdep ${COPTS} ${CFILES} ioconf.c +startup.o: ../startup.S + ${COMPILE_S} ioconf.o: ioconf.c - ${CC} -c ${CFLAGS} ioconf.c + ${COMPILE_C} %RULES diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 8fcbcc8..0aefc2d 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -1,6 +1,32 @@ -IDENT=-DCHIPKIT_MAX -DPIC32MX7 -DPWM_ENABLED -DADC_ENABLED -DGPIO_ENABLED -DSD0_CS_PIN=4 -DSD0_CS_PORT=TRISD -DSD0_PORT=2 -DSD0_MHZ=10 -DSPI_ENABLED -DCONSOLE_DEVICE=tty0 -DUART4_ENABLED -DUART3_ENABLED -DUART2_ENABLED -DUART1_ENABLED -DLED_KERNEL_PIN=3 -DLED_KERNEL_PORT=TRISA -DUCB_METER -DEXEC_SCRIPT -DEXEC_ELF -DEXEC_AOUT -DBUS_DIV=1 -DHZ=100 -DBUS_KHZ=80000 -DCPU_KHZ=80000 -LDSCRIPT="cfg/bootloader-max32.ld" -PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=1 +PARAM = -DCHIPKIT_MAX +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=14 +PARAM += -DSD0_CS_PORT=TRISC +PARAM += -DSD0_PORT=2 +PARAM += -DSD0_MHZ=10 +PARAM += -DSPI_ENABLED +PARAM += -DCONSOLE_DEVICE=tty0 +PARAM += -DUART4_ENABLED +PARAM += -DUART3_ENABLED +PARAM += -DUART2_ENABLED +PARAM += -DUART1_ENABLED +PARAM += -DLED_KERNEL_PIN=3 +PARAM += -DLED_KERNEL_PORT=TRISA +PARAM += -DUCB_METER +PARAM += -DEXEC_SCRIPT +PARAM += -DEXEC_ELF +PARAM += -DEXEC_AOUT +PARAM += -DBUS_DIV=1 +PARAM += -DHZ=100 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +PARAM += -DTIMEZONE=480 +PARAM += -DDST=1 +PARAM += -DMAXUSERS=1 +LDSCRIPT = "cfg/bootloader-max32.ld" # # Makefile for RetroBSD, pic32 target # @@ -24,14 +50,14 @@ endif # sources are located via $S relative to the compilation directory S = ../.. -COPTS = -I. ${IDENT} -DKERNEL -CFLAGS = -O ${COPTS} ${PARAM} +DEFS = -I. ${PARAM} -DKERNEL +CFLAGS = -O ${DEFS} # compile rules: rules are named COMPILE_${SUFFIX} # SUFFIX is the file suffix, capitalized (e.g. C for a .c file). COMPILE_C = ${CC} -c ${CFLAGS} $< -COMPILE_S = ${CC} -c ${COPTS} $< +COMPILE_S = ${CC} -c ${DEFS} $< OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o \ init_main.o init_sysent.o kern_clock.o kern_descrip.o \ @@ -114,24 +140,17 @@ reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig load: unix.elf pic32prog unix.hex -startup.o: ../startup.S - ${COMPILE_S} - -# the following are necessary because the files depend on the types of -# cpu's included in the system configuration -clock.o machdep.o conf.o: Makefile - machine: ln -s .. $@ sys: ln -s ../../include $@ -depend: machine - mkdep ${COPTS} ${CFILES} ioconf.c +startup.o: ../startup.S + ${COMPILE_S} ioconf.o: ioconf.c - ${CC} -c ${CFLAGS} ioconf.c + ${COMPILE_C} exec_aout.o: $S/kernel/exec_aout.c ${COMPILE_C} diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index 7601fd4..e1d4cc6 100644 --- a/tools/kconfig/config.h +++ b/tools/kconfig/config.h @@ -163,7 +163,6 @@ struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; int zone, hadtz; int dst; -int hz; int debugging; int maxusers; diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index e2692fe..f8212b6 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -419,6 +419,7 @@ void makefile() char line[BUFSIZ]; struct opt *op; struct users *up; + struct cputype *cp; read_files(); strcpy(line, "../Makefile.kconf"); @@ -433,23 +434,21 @@ void makefile() perror("Makefile"); exit(1); } - fprintf(ofp, "IDENT=-D%s", raise(ident)); + fprintf(ofp, "PARAM = -D%s\n", raise(ident)); if (cputype == 0) { printf("cpu type must be specified\n"); exit(1); } - { struct cputype *cp; - for (cp = cputype; cp; cp = cp->cpu_next) - fprintf(ofp, " -D%s", cp->cpu_name); + for (cp = cputype; cp; cp = cp->cpu_next) { + fprintf(ofp, "PARAM += -D%s\n", cp->cpu_name); } - for (op = opt; op; op = op->op_next) + for (op = opt; op; op = op->op_next) { if (op->op_value) - fprintf(ofp, " -D%s=\"%s\"", op->op_name, op->op_value); + fprintf(ofp, "PARAM += -D%s=\"%s\"\n", op->op_name, op->op_value); else - fprintf(ofp, " -D%s", op->op_name); - fprintf(ofp, "\n"); - if (ldscript) - fprintf(ofp, "LDSCRIPT=\"%s\"\n", ldscript); + fprintf(ofp, "PARAM += -D%s\n", op->op_name); + } + if (hadtz == 0) printf("timezone not specified; gmt assumed\n"); if ((unsigned)machine > NUSERS) { @@ -465,15 +464,19 @@ void makefile() maxusers = up->u_min; } else if (maxusers > up->u_max) printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers); - fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d", - zone, dst, maxusers); - if (hz > 0) - fprintf(ofp, " -DHZ=%d", hz); - fprintf(ofp, "\n"); + fprintf(ofp, "PARAM += -DTIMEZONE=%d\n", zone); + fprintf(ofp, "PARAM += -DDST=%d\n", dst); + fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers); + + if (ldscript) + fprintf(ofp, "LDSCRIPT = \"%s\"\n", ldscript); + for (op = mkopt; op; op = op->op_next) - fprintf(ofp, "%s=%s\n", op->op_name, op->op_value); + fprintf(ofp, "%s = %s\n", op->op_name, op->op_value); + if (debugging) - fprintf(ofp, "DEBUG=-g\n"); + fprintf(ofp, "DEBUG = -g\n"); + while (fgets(line, BUFSIZ, ifp) != 0) { if (*line != '%') { fprintf(ofp, "%s", line);