Changeset d2f75eb in mainline for uspace/lib/c/Makefile


Ignore:
Timestamp:
2018-04-17T20:46:03Z (7 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0582039
Parents:
1cac875
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-04-17 20:46:03)
git-committer:
GitHub <noreply@…> (2018-04-17 20:46:03)
Message:

Replace autogen.py with something simpler. (#30)

Instead of generating headers for certain structures, the headers are written manually and we automate checking correctness instead. Checking is performed by generating a C source with a bunch of static asserts, using a simple awk script. This is then treated as a normal source file.

The primary motivation for this change is to reduce the complexity of the build process. Also, the .ag files we used previously are more difficult to understand than regular C code, and at least one IDE (GNOME Builder) completely refuses to open them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    r1cac875 rd2f75eb  
    4747-include arch/$(UARCH)/Makefile.inc
    4848
    49 ARCH_AUTOGENS_H := $(addsuffix .h,$(basename $(ARCH_AUTOGENS_AG)))
    50 ARCH_AUTOGENS_PROBE_C := $(addsuffix .ag.probe.c,$(basename $(ARCH_AUTOGENS_AG)))
    51 ARCH_AUTOGENS_PROBE_S := $(addsuffix .ag.probe.s,$(basename $(ARCH_AUTOGENS_AG)))
    52 
    53 PRE_DEPEND += $(ARCH_AUTOGENS_H)
    54 EXTRA_CLEAN += $(ARCH_AUTOGENS_H) $(ARCH_AUTOGENS_PROBE_C) $(ARCH_AUTOGENS_PROBE_S)
     49ARCH_AUTOGENS_PROBE_C := $(ARCH_AUTOGENS_AG:%.ag.h=.ag.c)
     50ARCH_AUTOGENS_PROBE_S := $(ARCH_AUTOGENS_AG:%.ag.h=.ag.s)
     51
     52PRE_DEPEND += $(ARCH_AUTOGENS_AG)
     53EXTRA_CLEAN += $(ARCH_AUTOGENS_AG) $(ARCH_AUTOGENS_PROBE_C) $(ARCH_AUTOGENS_PROBE_S)
    5554
    5655GENERIC_SOURCES = \
     
    179178endif
    180179
     180ARCH_SOURCES += $(ARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
     181
    181182SOURCES = \
    182183        $(GENERIC_SOURCES) \
     
    195196include $(USPACE_PREFIX)/Makefile.common
    196197
    197 %.h: %.ag
    198         $(AUTOGEN) probe $< >$<.probe.c
    199         $(CC_AUTOGEN) $(DEFS) $(CFLAGS) -S -o $<.probe.s $<.probe.c
    200         $(AUTOGEN) generate $< <$<.probe.s >$@
    201 
    202198$(LIBC_PREFIX)/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
    203199        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
     
    208204$(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
    209205        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@
     206
     207AUTOCHECK = $(realpath $(ROOT_PATH)/tools/autocheck.awk)
     208
     209%.check.c: %.h $(AUTOCHECK)
     210        cd $(<D) && $(AUTOCHECK) $(<F) > $(@F)
Note: See TracChangeset for help on using the changeset viewer.