mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 21:42:40 +07:00
30 lines
1.1 KiB
Makefile
30 lines
1.1 KiB
Makefile
# Top directory for building complete system, fall back to this directory
|
|
ROOTDIR ?= $(TOPDIR)
|
|
|
|
# Some junk files we always want to be removed when doing a make clean.
|
|
JUNK = *~ *.bak *.aux *.dvi *.idx *.ind *.log *.ps *.map .*.d DEADJOE semantic.cache *.gdb *.elf core core.*
|
|
MAKE := @$(MAKE)
|
|
MAKEFLAGS = --no-print-directory --silent
|
|
CHECK := cppcheck $(CPPFLAGS) --quiet --enable=all
|
|
INSTALL := install --backup=off
|
|
STRIPINST := $(INSTALL) -s --strip-program=$(CROSS)strip -m 0755
|
|
|
|
# Smart autodependecy generation via GCC -M.
|
|
.%.d: %.c
|
|
@$(SHELL) -ec "$(CC) -MM $(CFLAGS) $(CPPFLAGS) $< \
|
|
| sed 's,.*: ,$*.o $@ : ,g' > $@; \
|
|
[ -s $@ ] || rm -f $@"
|
|
|
|
# Override default implicit rules
|
|
%.o: %.c
|
|
@printf " CC $(subst $(ROOTDIR)/,,$(shell pwd)/$@)\n"
|
|
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
|
|
|
%: %.o
|
|
@printf " LINK $(subst $(ROOTDIR)/,,$(shell pwd)/$@)\n"
|
|
@$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$@.map -o $@ $^ $(LDLIBS$(LDLIBS-$(@)))
|
|
|
|
%.so: %.o
|
|
@printf " PLUGIN $(subst $(ROOTDIR)/,,$(shell pwd)/$@)\n"
|
|
@$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|