Commit b1355998 authored by Daniel Friesel's avatar Daniel Friesel
Browse files

prepare for switch to config.h instead of CFLAGS defines

parent 168ea4b5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -380,6 +380,9 @@ endif

default: build/system.elf

include/config.h: .config
	${QUIET}awk -f script/conf2h.awk .config > include/config.h

stack: default
	${QUIET}test -n "${OBJDUMP}"
	${QUIET}test -n "${ARCH_SHORTNAME}"

script/conf2h.awk

0 → 100644
+35 −0
Original line number Diff line number Diff line
#! /usr/bin/gawk -f
#
# Copyright 2021 AG Eingebettete Softwaresysteme, Universität Osnabrück
#
# SPDX-License-Identicier: CC0-1.0

BEGIN {
  print "// config.h generated from " ARGV[1] "\n" \
    "#ifndef CONFIG_H\n" \
    "#define CONFIG_H"
}

/^CONFIG_.*?_INSTANCES=/ { next }

/^#/ { sub(/^#/,"//") }

/^CONFIG_.*?=/ {
  if (/=n$/) {
    sub(/^/,"// ");
  } else {
    sub(/^/,"#define ")
    if (/=y$/) {
      sub(/=.*$/,"")
    } else if (/=".*"$/) {
      sub(/="/, " ")
      sub(/"$/, "")
    } else {
      sub(/=/," ")
    }
  }
}

{ print }

END { print "#endif" }
+2 −2
Original line number Diff line number Diff line
@@ -140,10 +140,10 @@ COMMON_FLAGS += -DBAUD=${uart_baud}UL

OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o}

.cc.o:
%.o : %.cc | include/config.h
	${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} -c -o $@ ${@:.o=.cc}

.c.o:
%.o : %.c | include/config.h
	${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} ${CFLAGS} -c -o $@ ${@:.o=.c}

build/system.elf: ${OBJECTS}
+2 −2
Original line number Diff line number Diff line
@@ -135,10 +135,10 @@ COMMON_FLAGS += -DBAUD=${uart_baud}UL

OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o}

.cc.o:
%.o : %.cc | include/config.h
	${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} -c -o $@ ${@:.o=.cc}

.c.o:
%.o : %.c | include/config.h
	${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} ${CFLAGS} -c -o $@ ${@:.o=.c}

build/system.elf: ${OBJECTS}
+2 −2
Original line number Diff line number Diff line
@@ -54,10 +54,10 @@ endif

OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o}

.cc.o:
%.o : %.cc | include/config.h
	${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} -c -o $@ ${@:.o=.cc}

.c.o:
%.o : %.c | include/config.h
	${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} ${CFLAGS} -c -o $@ ${@:.o=.c}

build/system.elf: ${OBJECTS}
Loading