Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c2b51d5

Browse files
committed
build test in build dir
1 parent 149844a commit c2b51d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CFLAGS = -O2
1212
BUILD = build
1313

1414
LIBSRCS = context.c varint.c array.c pattern.c register.c proto.c map.c alloc.c rmessage.c wmessage.c bootstrap.c stringpool.c
15-
LIBNAME = $(BUILD)/libpbc.$(SO)
15+
LIBNAME = libpbc.$(SO)
1616

1717
TESTSRCS = addressbook.c pattern.c
1818
PROTOSRCS = addressbook.proto descriptor.proto
@@ -45,7 +45,7 @@ endef
4545
$(foreach s,$(LIBSRCS),$(eval $(call BUILD_temp,$(s))))
4646

4747
$(LIBNAME) : $(LIB_O)
48-
$(CC) --shared -o $(LIBNAME) $^
48+
cd $(BUILD) && $(CC) --shared -o $(LIBNAME) $(addprefix ../,$^)
4949

5050
TEST :=
5151

@@ -55,7 +55,7 @@ define TEST_temp
5555
$$(TAR)$$(EXE) : | $(BUILD)
5656
$$(TAR)$$(EXE) : | $(LIBNAME)
5757
$$(TAR)$$(EXE) : test/$(1)
58-
$(CC) $(CFLAGS) -I. -L$(BUILD) -lpbc -o $$@ $$<
58+
cd $(BUILD) && $(CC) $(CFLAGS) -I.. -L. -lpbc -o $$(notdir $$@) ../$$<
5959
endef
6060

6161
$(foreach s,$(TESTSRCS),$(eval $(call TEST_temp,$(s))))

0 commit comments

Comments
 (0)