diff options
| author | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-06-06 02:53:03 -0500 |
|---|---|---|
| committer | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-06-06 02:53:03 -0500 |
| commit | f99e6d1e70ed0cc0fc0153156858ddb439d1c574 (patch) | |
| tree | d691a7abb8c999eb9e25d3ca15a1aaf26f1c4fc3 /scripts | |
| parent | f56dec0252d197c3796f3f932eeea1f29a499505 (diff) | |
kbuild: Add rules for compiling programs on the host
At a couple of places, we need to build programs which run on the
compile host during building the kernel.
Add a new variable "host-progs" to declare such programs. Rules.make will
automatically provide rules to compile these programs with appropriate
command lines etc.
Compared to having explicit rules spread around for doing so, this has
the following advantages:
o shorter
o automatically figures out dependencies and handles changing command
lines
o Nicer output in quiet mode ;-)
Compiling host programs from multiple sources is also possible, analogous
to multi-part objects. E.g. scripts/Makefile has
host-progs := tkparse
tkparse-objs := tkparse.o tkcond.o tkgen.o
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile | 22 | ||||
| -rw-r--r-- | scripts/lxdialog/Makefile | 25 |
2 files changed, 15 insertions, 32 deletions
diff --git a/scripts/Makefile b/scripts/Makefile index 9968873e37ae..11509a5bfd74 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -9,12 +9,6 @@ CHMOD_FILES := docgen gen-all-syms kernel-doc mkcompile_h makelst all: fixdep split-include $(CHMOD_FILES) -fixdep: fixdep.c - $(HOSTCC) $(HOSTCFLAGS) -o $@ $< - -split-include: split-include.c - $(HOSTCC) $(HOSTCFLAGS) -o $@ $< - $(CHMOD_FILES): FORCE @chmod a+x $@ @@ -43,23 +37,15 @@ kconfig.tk: $(TOPDIR)/arch/$(ARCH)/config.in tkparse $(HEADER) $(TAIL) FORCE ) > $@ chmod 755 $@ -tkparse: tkparse.o tkcond.o tkgen.o - $(HOSTCC) -o $@ $^ - -tkparse.o tkcond.o tkgen.o: %.o: %.c - $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< - # DocBook stuff # --------------------------------------------------------------------------- doc-progs: docproc -docproc: docproc.c - $(HOSTCC) $(HOSTCFLAGS) -o $@ $< - -include $(TOPDIR)/Rules.make +# --------------------------------------------------------------------------- -# we don't have automatic deps for host programs +host-progs := fixdep split-include docproc tkparse -tkparse.o tkcond.o tkgen.o: tkparse.h +tkparse-objs := tkparse.o tkcond.o tkgen.o +include $(TOPDIR)/Rules.make diff --git a/scripts/lxdialog/Makefile b/scripts/lxdialog/Makefile index ed8d17c37823..1ab9518b1656 100644 --- a/scripts/lxdialog/Makefile +++ b/scripts/lxdialog/Makefile @@ -1,35 +1,32 @@ -HOSTCFLAGS += -DLOCALE -LIBS = -lncurses +HOST_EXTRACFLAGS := -DLOCALE +HOST_LOADLIBES := -lncurses ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) - HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" + HOST_EXTRACFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" else ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) - HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" + HOST_EXTRACFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" else ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) - HOSTCFLAGS += -DCURSES_LOC="<ncurses.h>" + HOST_EXTRACFLAGS += -DCURSES_LOC="<ncurses.h>" else - HOSTCFLAGS += -DCURSES_LOC="<curses.h>" + HOST_EXTRACFLAGS += -DCURSES_LOC="<curses.h>" endif endif endif +host-progs := lxdialog -OBJS = checklist.o menubox.o textbox.o yesno.o inputbox.o \ - util.o lxdialog.o msgbox.o - -%.o: %.c - $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< +lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ + util.o lxdialog.o msgbox.o all: ncurses lxdialog -lxdialog: $(OBJS) - $(HOSTCC) -o lxdialog $(OBJS) $(LIBS) +include $(TOPDIR)/Rules.make ncurses: @echo "main() {}" > lxtemp.c - @if $(HOSTCC) -lncurses lxtemp.c ; then \ + @if $(HOSTCC) lxtemp.c $(HOST_LOADLIBES); then \ rm -f lxtemp.c a.out; \ else \ rm -f lxtemp.c; \ |
