#*******************************************************************************
#* libraries/cstandard/Makefile
#*                                                                   2012/09/22
#* Copyright (C) 2012 Mochi
#*******************************************************************************
# ライブラリ名
NAME = cstandard

# オブジェクトファイル
OBJS = $(patsubst %c, %o, $(wildcard */*.c))

# GCCオプション
CFLAGS = \
	-ffreestanding \
	-fno-stack-protector \
	-I../../include

#*********
# Actions
#*********
.PHONY: all clean mostlyclean
all: ../lib$(NAME).a

clean: mostlyclean
	-rm -f ../lib$(NAME).a
	-rm -f $(OBJS)

mostlyclean:
	-rm -f *~

#*******
# Rules
#*******
%.o: %.s Makefile
	$(AS) -o $@ $<

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

../lib$(NAME).a: $(OBJS) Makefile
	$(AR) rcs $@ $(OBJS)
