aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/Makefile
blob: 7ae6bd96259f2bb04a312cef5741b353edd4d0f3 (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
CFLAGS = -c -fno-stack-protector -nostdlib -static -Iinclude/
LIBC_CFILES = $(shell find src/ -name "*.c")
LIBC_ASMFILES = $(shell find src/ -name "*.S")

LIBC_OBJ = $(LIBC_CFILES:.c=.o)
LIBC_ASMOBJ = $(LIBC_ASMFILES:.S=.S.o)

all: headers $(LIBC_ASMOBJ) $(LIBC_OBJ) build/libc.a

build/libc.a: build/
	ar rcs build/libc.a $(LIBC_OBJ) $(LIBC_ASMOBJ)

%.o: %.c
	$(CC) $(CFLAGS) -Iinclude/ $< -o $@

%.S.o: %.S
	$(CC) $(CFLAGS) -Iinclude/ $< -o $@

.PHONY: headers
headers:
	mkdir -p include/sys/
	cp -f $(USRDIR)/include/sys/*.h include/sys
	cp -f include/*.h $(USRDIR)/include/

.PHONY:
build/:
	mkdir -p build/

.PHONY: clean
clean:
	rm -f $(LIBC_OBJ) $(LIBC_ASMOBJ)
	rm -rf build/