BarryServer : Git

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

// Related

OrionLibC

Barry Importing existing Orion LibC 03048a9 (2 years, 3 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)