summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-04-21 16:39:23 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-04-21 16:39:23 -0400
commitf2cb2215213c0d831a697b0b440f78d9ad5c2b83 (patch)
tree70b6aca6198fb417ca8f676c42fe4bdd33a2d203
parent893f208557dc2d0c047355004d2f1d47d675f24a (diff)
downloadbfs-f2cb2215213c0d831a697b0b440f78d9ad5c2b83.tar.xz
Makefile: Put the main .o files under build/src
-rw-r--r--.github/workflows/codecov.yml2
-rw-r--r--Makefile66
2 files changed, 32 insertions, 36 deletions
diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml
index 7901b6d..9bb407a 100644
--- a/.github/workflows/codecov.yml
+++ b/.github/workflows/codecov.yml
@@ -25,7 +25,7 @@ jobs:
- name: Generate coverage
run: |
make -j$(nproc) gcov check
- gcov -abcfu build/*.o build/tests/*.o
+ gcov -abcfu build/*/*.o
- uses: codecov/codecov-action@v2
with:
diff --git a/Makefile b/Makefile
index 753d4b3..bfd5e37 100644
--- a/Makefile
+++ b/Makefile
@@ -200,49 +200,45 @@ all: $(BIN_GOALS)
.PHONY: all
bfs: \
- build/bar.o \
- build/bftw.o \
- build/color.o \
- build/ctx.o \
- build/darray.o \
- build/diag.o \
- build/dir.o \
- build/dstring.o \
- build/eval.o \
- build/exec.o \
- build/fsade.o \
- build/main.o \
- build/mtab.o \
- build/opt.o \
- build/parse.o \
- build/printf.o \
- build/pwcache.o \
- build/stat.o \
- build/trie.o \
- build/typo.o \
- build/util.o \
- build/xregex.o \
- build/xspawn.o \
- build/xtime.o
+ build/src/bar.o \
+ build/src/bftw.o \
+ build/src/color.o \
+ build/src/ctx.o \
+ build/src/darray.o \
+ build/src/diag.o \
+ build/src/dir.o \
+ build/src/dstring.o \
+ build/src/eval.o \
+ build/src/exec.o \
+ build/src/fsade.o \
+ build/src/main.o \
+ build/src/mtab.o \
+ build/src/opt.o \
+ build/src/parse.o \
+ build/src/printf.o \
+ build/src/pwcache.o \
+ build/src/stat.o \
+ build/src/trie.o \
+ build/src/typo.o \
+ build/src/util.o \
+ build/src/xregex.o \
+ build/src/xspawn.o \
+ build/src/xtime.o
build/tests/mksock: build/tests/mksock.o
-build/tests/trie: build/trie.o build/tests/trie.o
-build/tests/xtimegm: build/xtime.o build/tests/xtimegm.o
+build/tests/trie: build/src/trie.o build/tests/trie.o
+build/tests/xtimegm: build/src/xtime.o build/tests/xtimegm.o
$(BIN_GOALS):
+$(CC) $(ALL_LDFLAGS) $^ $(ALL_LDLIBS) -o $@
-build build/tests:
- $(MKDIR) $@
-
-build/%.o: src/%.c build/FLAGS
- $(CC) $(ALL_CFLAGS) -c $< -o $@
-
-build/tests/%.o: tests/%.c build/FLAGS | build/tests
+build/%.o: %.c build/FLAGS
+ @$(MKDIR) $(@D)
$(CC) $(ALL_CFLAGS) -c $< -o $@
# Save the full set of flags to rebuild everything when they change
-build/FLAGS.new: | build
+build/FLAGS.new:
+ @$(MKDIR) $(@D)
@echo $(CC) : $(ALL_CFLAGS) : $(ALL_LDFLAGS) : $(ALL_LDLIBS) >$@
.PHONY: build/FLAGS.new
@@ -250,7 +246,7 @@ build/FLAGS.new: | build
build/FLAGS: build/FLAGS.new
@test -e $@ && cmp -s $@ $< && rm $< || mv $< $@
-# Make sure that "make release" builds everything, but "make release build/main.o" doesn't
+# Make sure that "make release" builds everything, but "make release build/src/main.o" doesn't
$(FLAG_GOALS): $(FLAG_PREREQS)
@:
.PHONY: $(FLAG_GOALS)