mirror of
https://git.planet-casio.com/Lephenixnoir/libprof.git
synced 2024-12-28 04:23:41 +01:00
46 lines
771 B
Makefile
46 lines
771 B
Makefile
#! /usr/bin/make -f
|
|
# libprof Makefile
|
|
|
|
cflags := -m3 -mb -ffreestanding -nostdlib -fstrict-volatile-bitfields -Wall \
|
|
-Wextra -Os -I .
|
|
target ?= sh-elf
|
|
lib := libprof.a
|
|
header := libprof.h
|
|
|
|
PREFIX ?= $(shell $(target)-gcc -print-search-dirs | grep install \
|
|
| sed 's/install: //')
|
|
|
|
ifeq "$(PREFIX)" ""
|
|
$(error "Cannot determine compiler install path")
|
|
endif
|
|
|
|
src := $(wildcard *.c)
|
|
obj := $(src:%=build/%.o)
|
|
|
|
# Rules
|
|
|
|
all: $(lib)
|
|
|
|
$(lib): $(obj)
|
|
$(target)-ar rcs $@ $^
|
|
|
|
build/%.c.o: %.c | build/
|
|
$(target)-gcc -c $< -o $@ $(cflags)
|
|
|
|
# Misc rules
|
|
|
|
clean:
|
|
@ rm -rf build
|
|
distclean: clean
|
|
@ rm -f $(lib)
|
|
|
|
%/:
|
|
mkdir -p $@
|
|
|
|
.PRECIOUS: %/
|
|
|
|
# Install
|
|
|
|
install: $(lib)
|
|
cp $(lib) $(DESTDIR)$(PREFIX)
|
|
cp $(header) $(DESTDIR)$(PREFIX)/include
|