-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile
79 lines (63 loc) · 2.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# GNU Makefile
# Copyright (C) 2012 Przemyslaw Pawelczyk <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SRCS := buffer.c houdini_href_e.c houdini_html_e.c houdini_html_u.c houdini_js_e.c houdini_js_u.c houdini_uri_e.c houdini_uri_u.c houdini_xml_e.c
OBJS := $(addsuffix .o,$(basename $(SRCS)))
DEPS := $(addsuffix .d,$(basename $(SRCS)))
NAME := houdini
SRCDIR := $(dir $(lastword $(MAKEFILE_LIST)))
OBJDIR ?= ./
OBJS := $(addprefix $(OBJDIR),$(OBJS))
SLIB := lib$(NAME).a
vpath %.c $(SRCDIR)
vpath %.h $(SRCDIR)
AR ?= ar
CC ?= gcc
GPERF ?= gperf
SED ?= sed
CFLAGS ?= -O2
# -Wno-missing-field-initializers - gperf's header doesn't pass on -Wextra
MANDATORY_FLAGS := -Wall -Wextra -Wno-missing-field-initializers
override CFLAGS := $(MANDATORY_FLAGS) $(CFLAGS)
.PHONY: all clean objects package
all: package
objects: $(OBJS)
package: $(SLIB)
$(SLIB): $(OBJS)
$(AR) rcs $@ $^
$(OBJS): | $(OBJDIR)
$(OBJDIR):
mkdir -p $@
$(OBJDIR)%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
%.d: %.c
@set -e; \
$(RM) $@; \
$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $< >[email protected]; \
$(SED) 's,\($*\)\.o[ :]*,$$(OBJDIR)\1.o $@: ,g' <[email protected] >$@; \
$(RM) [email protected]
html_unescape.h: html_unescape.gperf
$(GPERF) -t -N find_entity -H hash_entity -K entity -C -l --null-strings -m100 $< >$@
clean:
$(RM) $(SLIB) $(OBJS) $(DEPS)
ifneq ($(MAKECMDGOALS),clean)
-include $(DEPS)
endif