BarryServer : Git

All the code for all my projects
// BarryServer : Git / OrionLibC / blob / fd1ac463b480044ea9b8ae4fa3f56a73b00e2ed3 / Makefile

// Related

OrionLibC

Barry Importing existing Orion LibC 03048a9 (2 years, 2 months ago)
PRODUCT=libc.a

CC=i686-orion-gcc
CFLAGS=

AS=i686-orion-as
AFLAGS=

AR=i686-orion-ar

AS_SOURCES := $(shell find . -name '*.S')
OBJS += $(subst ./,build/,$(subst .S,.o,$(AS_SOURCES)))

C_SOURCES := $(shell find . -name '*.c')
OBJS += $(subst ./,build/,$(subst .c,.o,$(C_SOURCES)))

.PHONY: install-headers clean all install

all: $(PRODUCT)

clean:
	@echo "REMOVING OBJECT FILES"
	@mkdir -p build
	@rm -rf build
	@touch $(PRODUCT)
	@rm $(PRODUCT)

install-headers:
	@echo "INSTALLING HEADERS"
	@mkdir -p ${SYSROOT}/usr/include/
	@cp -r include/* ${SYSROOT}/usr/include/

install: $(PRODUCT) build/crt0.o build/crti.o build/crtn.o
	@echo "INSTALLING $^"
	@install -Dm 644 $^ -t ${SYSROOT}/usr/lib/

$(PRODUCT): $(OBJS)
	@echo "LINKING $@"
	@mkdir -p $(@D)
	@$(AR) rcs $@ $^

build/%.o: %.c
	@echo "COMPILING $<"
	@mkdir -p $(@D)
	@$(CC) -c $< -o $@ $(CFLAGS)

build/%.o: %.S
	@echo "ASSEMBLING $<"
	@mkdir -p $(@D)
	@$(AS) $< -o $@ $(AFLAGS)