Skip to content

Commit

Permalink
put object files into build directory
Browse files Browse the repository at this point in the history
  • Loading branch information
taliastocks committed Jan 6, 2024
1 parent 21ce1bb commit 457376c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
23 changes: 12 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@ YL_LDLIBS = -llua -lyaml -lm -largp
.PHONY: all
all: main.out

main.out: environment.o error.o event.o executor.o main.o parser.o render.o test.o
$(CC) $(ALL_CFLAGS) $^ $(YL_LDFLAGS) $(YL_LDLIBS) -o main.out
main.out: build/environment.o build/error.o build/event.o build/executor.o build/main.o build/parser.o build/render.o build/test.o
$(CC) $(ALL_CFLAGS) $^ $(YL_LDFLAGS) $(YL_LDLIBS) -o $@

%.o: %.c
$(CC) $(ALL_CFLAGS) -c $<
build/%.o: %.c
mkdir -p build
$(CC) $(ALL_CFLAGS) -c $< -o $@

deps.mk: *.c *.h
./deps.sh >deps.mk
deps.mk: *.c *.h deps.sh
./deps.sh >$@
include deps.mk

lua:
mkdir -p lua
curl https://www.lua.org/ftp/lua-5.4.6.tar.gz | tar xvzC lua --strip-components=1
mkdir -p $@
curl https://www.lua.org/ftp/lua-5.4.6.tar.gz | tar xvzC $@ --strip-components=1

lua/install: lua
cd lua && make all local

libyaml:
mkdir -p libyaml
curl https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz | tar xvzC libyaml --strip-components=1
mkdir -p $@
curl https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz | tar xvzC $@ --strip-components=1

libyaml/Makefile: libyaml
cd libyaml && ./configure --prefix="${CURDIR}/libyaml/install"
Expand All @@ -38,4 +39,4 @@ libyaml/install: libyaml/Makefile

.PHONY: clean
clean:
rm -rf lua libyaml *.o *.out
rm -rf lua libyaml build *.o *.out
16 changes: 8 additions & 8 deletions deps.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
environment.o: environment.h lua/install
error.o: error.h libyaml/install
event.o: error.h event.h executor.h libyaml/install lua/install parser.h render.h
executor.o: error.h event.h executor.h libyaml/install lua/install parser.h
main.o: environment.h error.h event.h executor.h libyaml/install lua/install parser.h render.h test.h
parser.o: error.h libyaml/install parser.h
render.o: error.h event.h executor.h libyaml/install lua/install parser.h render.h
test.o: error.h event.h executor.h libyaml/install lua/install parser.h render.h test.h
build/environment.o: environment.h lua/install
build/error.o: error.h libyaml/install
build/event.o: error.h event.h executor.h libyaml/install lua/install parser.h render.h
build/executor.o: error.h event.h executor.h libyaml/install lua/install parser.h
build/main.o: environment.h error.h event.h executor.h libyaml/install lua/install parser.h render.h test.h
build/parser.o: error.h libyaml/install parser.h
build/render.o: error.h event.h executor.h libyaml/install lua/install parser.h render.h
build/test.o: error.h event.h executor.h libyaml/install lua/install parser.h render.h test.h
2 changes: 1 addition & 1 deletion deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ function dependencies() {
}

for file in *.c; do
echo "${file/%.c/.o}:" $(dependencies "$file" | sort | uniq)
echo "build/${file/%.c/.o}:" $(dependencies "$file" | sort | uniq)
done

0 comments on commit 457376c

Please sign in to comment.