Move notice of GNUTLS >= 1.2 requirement to NEWS file
[elinks.git] / Makefile.lib
blobf1febf501156d96de67eb2e0e986f8d9f2c35275
1 ### The build commands and verbosity
3 # If we are verbose, we will show commands prefixed by $(Q) (which acts as
4 # @ in the non-verbose mode), and we will show the "real" cmds instead of
5 # their quiet versions (which are used in the non-verbose mode).
6 # Inspired by the Linux kernel build system.
7 ifdef V
8         Q =
9         quiet =
10         mquiet = masq_
11 else
12         Q = @
13         quiet = quiet_
14         mquiet = quiet_
15 endif
17 # Show the command (quiet or non-quiet version based on the assignment
18 # just above) and then execute it.
19 ncmd = $(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1))
20 cmd = @$(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1))
21 mcmd = @$(if $($(mquiet)cmd_$(1)),echo $($(mquiet)cmd_$(1)) &&) $(cmd_$(1))
23 quiet_cmd_compile = '[CC]   $<'
24  masq_cmd_compile = $(COMPILE) -c $<
25       cmd_compile = $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
27 quiet_cmd_archive = '[AR]   $@'
28       cmd_archive = $(AR) r $@ $^
30    quiet_cmd_link = '[LINK] $@'
31          cmd_link = $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
33 # Recursive make
34 quiet_cmd_recmake = "[MAKE $$target]   $$subdir"
35       cmd_recmake = $(MAKE) -C $$subdir $$target
39 ### Internal build rules
41 DEP_FILES_1 = $(foreach src,$(OBJS),.deps/$(src))
42 DEP_FILES = $(DEP_FILES_1:%.o=%.P)
44 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
46 ifdef OBJS
47 -include $(DEP_FILES)
48 endif
50 %.o: %.c
51         $(call mcmd,compile)
52         @-cp .deps/$(*F).pp .deps/$(*F).P; \
53                 tr ' ' '\012' < .deps/$(*F).pp \
54                         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
55                         >> .deps/$(*F).P; \
56                 rm .deps/$(*F).pp
58 %.a:
59         $(call cmd,archive)
61 ifdef OBJS
62 clean-l:
63         rm -f $(OBJS) *.a
64 endif
67 # Recursion:
69 .PHONY: all-recursive install-recursive clean-recursive
70 all-recursive install-recursive clean-recursive:
71         @target=`echo $@ | sed s/-recursive//`; \
72         for subdir in $(SUBDIRS); do \
73                 $(call ncmd,recmake) || exit 1; \
74         done
76 all: all-recursive all-l
77 install: install-recursive install-l
78 clean: clean-recursive clean-l
80 all-l:
81 install-l:
82 clean-l:
85 # vim:syntax=make