Makefile 2.28 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
WR_INSTALL_ROOT ?= /usr/lib/white-rabbit

# # Standard stanza for cross-compilation (courtesy of the linux makefile)

AS              = $(CROSS_COMPILE)as
LD              = $(CROSS_COMPILE)ld
CC              = $(CROSS_COMPILE)gcc
CPP             = $(CC) -E
AR              = $(CROSS_COMPILE)ar
NM              = $(CROSS_COMPILE)nm
STRIP           = $(CROSS_COMPILE)strip
OBJCOPY         = $(CROSS_COMPILE)objcopy
OBJDUMP         = $(CROSS_COMPILE)objdump

CFLAGS =  -D KBUILD_NO_NLS

# most of this is just copying stuff in
18 19
RFILES = Kconfig_sfp_fiber.in Kconfig_port_timing.in Kconfig Kconfig_vlans.in \
		dot-config wrs_release_defconfig 
20
XFILES = conf mconf nconf
21
FILES = $(RFILES) $(XFILES)
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

all: $(FILES)

install: all
	install -d $(WR_INSTALL_ROOT)/etc
	install -m 644 $(RFILES) $(WR_INSTALL_ROOT)/etc
	install -m 755 $(XFILES) $(WR_INSTALL_ROOT)/etc
	install -m 644 Makefile-for-target $(WR_INSTALL_ROOT)/etc/Makefile

clean:
	rm -f $(FILES)

dot-config: $(WRS_BASE_DIR)/../.config
	cp $^ $@

Kconfig: $(WRS_BASE_DIR)/../Kconfig
	cp $^ $@
39

40 41 42
Kconfig_port_timing.in: $(WRS_BASE_DIR)/../Kconfig_port_timing.in
	cp $^ $@

43 44 45
Kconfig_sfp_fiber.in: $(WRS_BASE_DIR)/../Kconfig_sfp_fiber.in
	cp $^ $@

46 47
Kconfig_vlans.in: $(WRS_BASE_DIR)/../Kconfig_vlans.in
	cp $^ $@
48

49 50
CONF_LOC=$(WRS_BASE_DIR)/../scripts/kconfig

51
conf:
52 53 54
	$(CC) $(CFLAGS) -o $@ $(CONF_LOC)/conf.c \
		$(CONF_LOC)/zconf.tab.c

55 56 57
# if BRVER not defined use a wildcard
BRVER?=2*
CURSES_BUILD := $(wildcard $(WRS_OUTPUT_DIR)/build/buildroot-$(BRVER))
58 59 60 61 62 63 64 65 66 67 68 69 70 71
CURSES_BUILD := $(wildcard $(CURSES_BUILD)/output/build/ncurses-*)

lxdialog := $(CONF_LOC)/lxdialog/checklist.c
lxdialog += $(CONF_LOC)/lxdialog/util.c
lxdialog += $(CONF_LOC)/lxdialog/inputbox.c
lxdialog += $(CONF_LOC)/lxdialog/textbox.c
lxdialog += $(CONF_LOC)/lxdialog/yesno.c
lxdialog += $(CONF_LOC)/lxdialog/menubox.c

mconf:
	$(CC) $(CFLAGS) -o $@ $(CONF_LOC)/mconf.c $(CONF_LOC)/zconf.tab.c \
		$(lxdialog) \
		-DCURSES_LOC="<curses.h>" -I$(CURSES_BUILD)/include \
		-L$(CURSES_BUILD)/lib -lncurses
72

73 74 75 76 77 78 79
nconf:
	$(CC) $(CFLAGS) -o $@ $(CONF_LOC)/nconf.c $(CONF_LOC)/zconf.tab.c \
		$(CONF_LOC)/nconf.gui.c \
		-DCURSES_LOC="<curses.h>" -I$(CURSES_BUILD)/include \
		-L$(CURSES_BUILD)/lib -lncurses -lmenu -lpanel
#	nconf.o zconf.tab.o nconf.gui.o

80 81 82
wrs_release_defconfig: $(WRS_BASE_DIR)/../configs/wrs_release_defconfig
	cp $^ $@