Add dynamic compilation option

This commit is contained in:
jaseg 2016-04-28 21:59:17 +02:00
parent dd685e3d8b
commit 64e25bef9c
3 changed files with 17 additions and 9 deletions

View file

@ -1,27 +1,35 @@
all: lolcat censor
.PHONY: install clean musl static
musl/lib/libc.a musl/lib/crt1.o:
cd musl; ./configure
make -C musl
musl: musl/lib/libc.a musl/lib/crt1.o
lolcat: lolcat.c musl
gcc -c -std=c11 -Wall -Imusl/include -o lolcat.o lolcat.c
gcc -s -nostartfiles -nodefaultlibs -nostdinc -static -ffunction-sections -fdata-sections -Wl,--gc-sections -o lolcat lolcat.o musl/lib/crt1.o musl/lib/libc.a
static: lolcat-static censor-static
censor: censor.c musl
gcc -c -std=c11 -Wall -Imusl/include -o censor.o censor.c
gcc -s -nostartfiles -nodefaultlibs -nostdinc -static -ffunction-sections -fdata-sections -Wl,--gc-sections -o censor censor.o musl/lib/crt1.o musl/lib/libc.a
lolcat-static: lolcat.c musl
gcc -c -std=c11 -Wall -Imusl/include -o lolcat.o $<
gcc -s -nostartfiles -nodefaultlibs -nostdinc -static -ffunction-sections -fdata-sections -Wl,--gc-sections -o $@ lolcat.o musl/lib/crt1.o musl/lib/libc.a
censor-static: censor.c musl
gcc -c -std=c11 -Wall -Imusl/include -o censor.o $<
gcc -s -nostartfiles -nodefaultlibs -nostdinc -static -ffunction-sections -fdata-sections -Wl,--gc-sections -o $@ censor.o musl/lib/crt1.o musl/lib/libc.a
lolcat: lolcat.c
gcc -std=c11 -Wall -o $@ $<
censor: censor.c
gcc -std=c11 -Wall -o $@ $<
install: lolcat censor
install lolcat /usr/local/bin
install censor /usr/local/bin
clean:
rm -f lolcat lolcat.o censor censor.o
rm -f lolcat lolcat-static.o lolcat-static censor censor-static.o censor-static
make -C musl clean
.PHONY: install clean musl