aa
This commit is contained in:
parent
e11f54f3a1
commit
7f5c6446f7
3
text_rendering/.gitignore
vendored
3
text_rendering/.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
*.png
|
*.png
|
||||||
test
|
test
|
||||||
|
obj/**
|
@ -1,7 +1,17 @@
|
|||||||
|
CC = gcc
|
||||||
LDFLAGS = -lm -lgrapheme -lSDL2 -lGLEW -lGL
|
LDFLAGS = -lm -lgrapheme -lSDL2 -lGLEW -lGL
|
||||||
CFLAGS = -g -Wall -Wextra -pedantic
|
CFLAGS = -g -Wall -Wextra -pedantic
|
||||||
SOURCE = main.c font.c cache.c hash.c util.c ren.c
|
|
||||||
HEADER = font.h hash.h cache.h util.h ren.h
|
|
||||||
|
|
||||||
test: ${HEADER} ${SOURCE}
|
.PHONY: clean all
|
||||||
gcc ${CFLAGS} ${LDFLAGS} ${SOURCE} -o test
|
all: test
|
||||||
|
|
||||||
|
cache.o: cache.c cache.h hash.h font.h util.h
|
||||||
|
font.o: font.c font.h stb_truetype.h stb_image_write.h util.h cache.h
|
||||||
|
hash.o: hash.c hash.h util.h
|
||||||
|
main.o: main.c ren.h util.h
|
||||||
|
ren.o: ren.c util.h font.h ren.h stack.h
|
||||||
|
util.o: util.c util.h
|
||||||
|
test: cache.o font.o hash.o main.o ren.o util.o
|
||||||
|
${CC} ${LDFLAGS} -o test cache.o font.o hash.o main.o ren.o util.o
|
||||||
|
clean:
|
||||||
|
rm -f cache.o font.o hash.o main.o ren.o util.o
|
||||||
|
44
text_rendering/genmake.sh
Executable file
44
text_rendering/genmake.sh
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
genobj() {
|
||||||
|
#echo "$1" | sed -e 's/^/obj\//' -e 's/\.c/\.o/'
|
||||||
|
echo "$1" | sed -e 's/\.c/\.o/'
|
||||||
|
}
|
||||||
|
|
||||||
|
genrule() {
|
||||||
|
#gcc -MM "$1" | sed 's/^/obj\//'
|
||||||
|
gcc -MM "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mkdir -p obj
|
||||||
|
rm -f objlist
|
||||||
|
|
||||||
|
cat > Makefile << EOF
|
||||||
|
CC = gcc
|
||||||
|
LDFLAGS = -lm -lgrapheme -lSDL2 -lGLEW -lGL
|
||||||
|
CFLAGS = -g -Wall -Wextra -pedantic
|
||||||
|
|
||||||
|
.PHONY: clean all
|
||||||
|
all: test
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for f in *.c; do
|
||||||
|
genrule $f >> Makefile
|
||||||
|
genobj $f >> objlist
|
||||||
|
done
|
||||||
|
|
||||||
|
mainrule='test: '
|
||||||
|
linkcmd=' ${CC} ${LDFLAGS} -o test '
|
||||||
|
cleanrule='clean:
|
||||||
|
rm -f '
|
||||||
|
while IFS="" read -r line; do
|
||||||
|
mainrule="$mainrule $line"
|
||||||
|
linkcmd="$linkcmd $line"
|
||||||
|
cleanrule="$cleanrule $line"
|
||||||
|
done < objlist
|
||||||
|
|
||||||
|
echo "$mainrule" >> Makefile
|
||||||
|
echo "$linkcmd" >> Makefile
|
||||||
|
echo "$cleanrule" >> Makefile
|
6
text_rendering/objlist
Normal file
6
text_rendering/objlist
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
cache.o
|
||||||
|
font.o
|
||||||
|
hash.o
|
||||||
|
main.o
|
||||||
|
ren.o
|
||||||
|
util.o
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user