summaryrefslogtreecommitdiff
path: root/Makefile
blob: f6aba9a5214943f8cfecb1b0a4bda09d9a83e3a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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

static: lolcat-static censor-static

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-static.o lolcat-static censor censor-static.o censor-static
	make -C musl clean