mirror of
https://github.com/troglobit/libite.git
synced 2026-11-09 16:21:18 +00:00
Cleanup of old shared rules.mk file, now only used by unit tests.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
94d42b3df7
commit
b57c257f09
1 file changed
+9
-47
@@ -1,30 +1,12 @@
|
|||||||
.PHONY: all clean distclean
|
|
||||||
|
|
||||||
# Figure out root of library, unless used as submodule
|
|
||||||
ROOTDIR ?= $(shell pwd)
|
|
||||||
|
|
||||||
CC ?= $(CROSS)gcc
|
|
||||||
AR ?= $(CROSS)ar
|
|
||||||
STRIP ?= $(CROSS)strip
|
|
||||||
INSTALL := install --backup=off
|
|
||||||
STRIPINST := $(INSTALL) -s --strip-program=$(CROSS)strip -m 0755
|
|
||||||
CFLAGS += -g -O0
|
CFLAGS += -g -O0
|
||||||
CPPFLAGS += -D_GNU_SOURCE
|
CPPFLAGS += -D_GNU_SOURCE
|
||||||
ARFLAGS = crus
|
|
||||||
|
|
||||||
# Default to silent build, use V=1 to get verbose mode.
|
|
||||||
ifeq ($V,1)
|
ifeq ($V,1)
|
||||||
Q =
|
|
||||||
PRINT = @true
|
|
||||||
REDIRECT =
|
|
||||||
MAKEFLAGS =
|
|
||||||
VERBOSE = -v
|
VERBOSE = -v
|
||||||
|
REDIRECT =
|
||||||
else
|
else
|
||||||
Q = @
|
|
||||||
PRINT = @printf
|
|
||||||
REDIRECT = >/dev/null
|
|
||||||
MAKEFLAGS = --no-print-directory --silent
|
|
||||||
VERBOSE =
|
VERBOSE =
|
||||||
|
REDIRECT = >/dev/null
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Some tests may need to be run as root, e.g. pidfile()
|
# Some tests may need to be run as root, e.g. pidfile()
|
||||||
@@ -34,35 +16,15 @@ else
|
|||||||
SUDO =
|
SUDO =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Default install paths
|
all: $(TARGET)
|
||||||
prefix ?= /usr/local
|
|
||||||
libdir ?= $(prefix)/lib
|
|
||||||
datadir ?= $(prefix)/share/doc/$(LIBNAME)
|
|
||||||
incdir ?= $(prefix)/include
|
|
||||||
|
|
||||||
# Pretty printing and GCC -M for auto dep files
|
|
||||||
%.o: %.c
|
|
||||||
$(PRINT) " CC $(subst $(ROOTDIR)/,,$(shell pwd)/)$@\n"
|
|
||||||
$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c -MMD -MP -o $@ $<
|
|
||||||
|
|
||||||
%: %.o
|
|
||||||
$(PRINT) " LINK $(subst $(ROOTDIR)/,,$(shell pwd)/)$@\n"
|
|
||||||
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$@.map -o $@ $^ $(LDLIBS$(LDLIBS-$(@)))
|
|
||||||
|
|
||||||
.PHONY: %.test
|
|
||||||
%.test: %.c
|
%.test: %.c
|
||||||
$(PRINT) " TEST $(subst $(ROOTDIR)/,,$(shell pwd)/)$(@:.test=)\n"
|
@printf " TEST $@\n"
|
||||||
$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -g -o $@ -DUNITTEST $< $(OBJS)
|
@$(CC) $(CFLAGS) $(CPPFLAGS) -g -o $@ -DUNITTEST $< $(OBJS)
|
||||||
$(Q)$(RM) $(OBJS)
|
@$(RM) $(OBJS)
|
||||||
$(Q)$(SUDO) ./$@ $(VERBOSE) $(REDIRECT)
|
@$(SUDO) ./$@ $(VERBOSE) $(REDIRECT)
|
||||||
|
|
||||||
|
|
||||||
# Default build rules for both main and unit test makefiles
|
|
||||||
all:: $(TARGET)
|
|
||||||
|
|
||||||
clean::
|
clean::
|
||||||
-$(Q)$(RM) $(OBJS) $(DEPS) $(TARGET) $(SOLIB) $(STATICLIB)
|
-@$(RM) $(OBJS) $(DEPS) $(TARGET) $(SOLIB) $(STATICLIB)
|
||||||
|
-@$(RM) $(JUNK) unittest *.o *.a *.so* *.unittest *.test
|
||||||
distclean::
|
|
||||||
-$(Q)$(RM) $(JUNK) unittest *.o *.a *.so* *.unittest *.test
|
|
||||||
|
|
||||||
Reference in new issue
Block a user