Skip to content

Commit 9ed8ce3

Browse files
committed
Correct makefiles to build linenoise correctly
1 parent c97c813 commit 9ed8ce3

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

Makefile.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ HSREQ$(1)_H_$(3) = \
337337
TSREQ$(1)_T_$(2)_H_$(3) = \
338338
$$(HSREQ$(1)_H_$(3)) \
339339
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME) \
340-
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
340+
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a \
341+
$$(TLIB$(1)_T_$(2)_H_$(3))/liblinenoise.a
341342

342343
# Prerequisites for complete stageN targets
343344
SREQ$(1)_T_$(2)_H_$(3) = \
@@ -491,6 +492,7 @@ include $(CFG_SRC_DIR)mk/host.mk
491492
include $(CFG_SRC_DIR)mk/stage0.mk
492493
include $(CFG_SRC_DIR)mk/rt.mk
493494
include $(CFG_SRC_DIR)mk/rustllvm.mk
495+
include $(CFG_SRC_DIR)mk/linenoise.mk
494496
include $(CFG_SRC_DIR)mk/tools.mk
495497
include $(CFG_SRC_DIR)mk/docs.mk
496498
include $(CFG_SRC_DIR)mk/llvm.mk

mk/linenoise.mk

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
######################################################################
2+
# linenoise - minimalistic readline alternative used by the REPL
3+
######################################################################
4+
5+
define DEF_LINENOISE_TARGETS
6+
7+
LINENOISE_CS_$(1) := $$(addprefix linenoise/, linenoise.c)
8+
LINENOISE_OBJS_$(1) := $(LINENOISE_CS_$(1):linenoise/%.c=linenoise/$(1)/%.o)
9+
10+
ALL_OBJ_FILES += $$(LINENOISE_OBJS_$(1))
11+
12+
linenoise/$(1)/liblinenoise.a: $$(LINENOISE_OBJS_$(1))
13+
@$$(call E, link: $$@)
14+
$$(Q)ar rcs $$@ $$<
15+
16+
linenoise/$(1)/%.o: linenoise/%.c $$(MKFILE_DEPS)
17+
@$$(call E, compile: $$@)
18+
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@,) $$<
19+
endef
20+
21+
# Instantiate template for all stages
22+
$(foreach target,$(CFG_TARGET_TRIPLES), \
23+
$(eval $(call DEF_LINENOISE_TARGETS,$(target))))

mk/target.mk

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@ USE_SNAPSHOT_RUNTIME=0
1212
USE_SNAPSHOT_CORELIB=0
1313
USE_SNAPSHOT_STDLIB=0
1414

15-
LINENOISE_OBJS_$(2) := linenoise/$(2)/linenoise.o
16-
ALL_OBJ_FILES += $$(LINENOISE_OBJS_$(2))
17-
18-
linenoise/$(2)/linenoise.o: linenoise/linenoise.c $$(MKFILE_DEPS)
19-
@$$(call E, compile: $$@)
20-
$$(Q)$$(call CFG_COMPILE_C_$(2), $$@,) $$<
21-
22-
linenoise/$(2)/liblinenoise.a: $$(LINENOISE_OBJS_$(2))
23-
@$$(call E, link: $$@)
24-
$$(Q)ar rcs $$@ $$<
25-
2615
define TARGET_STAGE_N
2716

2817
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \

0 commit comments

Comments
 (0)