]> git.ipfire.org Git - thirdparty/gcc.git/blame - libcody/Makefile.in
configure: Implement --enable-host-pie
[thirdparty/gcc.git] / libcody / Makefile.in
CommitLineData
36230329
NS
1# Nathan's generic Makefile -*- mode:Makefile -*-
2# Copyright (C) 2019-2020 Nathan Sidwell, nathan@acm.org
3# License: Apache v2.0
4
36230329
NS
5srcdir := @srcdir@
6prefix := @prefix@
7exec_prefix := @exec_prefix@
8bindir := @bindir@
9libdir := @libdir@
10includedir := @includedir@
e2aa8a5f
NS
11# Linker options
12LDFLAGS := @LDFLAGS@
13LIBS := @LIBS@
36230329
NS
14
15# We have to place the -I paths last, so that building will see -I paths to us
16CXX := $(filter-out -I%,@CXX@)
17AR := @AR@
626b63d6 18RANLIB := @RANLIB@
36230329
NS
19INSTALL := $(srcdir)/build-aux/install-sh
20
21# C++ compiler options
22CXXFLAGS := @CXXFLAGS@
23CXXINC := $(filter -I%,@CXX@)
d1ad55c4 24CXXOPTS := $(CXXFLAGS) @PICFLAG@
e2aa8a5f 25
36230329
NS
26ifneq (@EXCEPTIONS@,yes)
27CXXOPTS += -fno-exceptions -fno-rtti
28endif
36230329
NS
29
30# Config
31CXXOPTS += $(filter-out -DHAVE_CONFIG_H,@DEFS@) -include config.h
32
33# Linker options
251c72a6 34LDFLAGS := @LDFLAGS@ @LD_PICFLAG@
36230329
NS
35LIBS := @LIBS@
36
37# Per-source & per-directory compile flags (warning: recursive)
38SRC_CXXFLAGS = $(CXXFLAGS$(patsubst $(srcdir)%,%,$1)) \
39 $(if $(filter-out $(srcdir)/,$1),\
40 $(call $0,$(dir $(patsubst %/,%,$1))))
41
42ifneq ($(MAINTAINER),)
43override MAINTAINER += $1
44endif
45ifeq (@MAINTAINER@,yes)
46MAINTAINER = $2
47else
48MAINTAINER = \# --enable-maintainer-mode to rebuild $1, or make MAINTAINER=touch
49endif
50
51vpath %.in $(srcdir)
52vpath %.cc $(srcdir)
53
54.SUFFIXES: .o .cc
55
56%.o: %.cc
57 @mkdir -p $(dir $@)
58 $(CXX) $(strip $(CXXOPTS) $(call SRC_CXXFLAGS,$<) $(CXXINC)) \
59 -MMD -MP -MF ${@:.o=.d} -c -o $@ $<
60
e2aa8a5f 61all:: Makefile
36230329 62
7a71ea4d
ML
63mostlyclean::
64
e2aa8a5f 65clean:: Makefile
36230329 66
e2aa8a5f
NS
67# FIXME: Delete
68revision.stamp: $(srcdir)/.
39ab2e4c 69 @revision=`git -C $(srcdir) rev-parse HEAD 2>/dev/null` ;\
36230329
NS
70 if test -n "$$revision" ;\
71 then revision=git-$$revision ;\
72 if git -C $(srcdir) status --porcelain 2>/dev/null | grep -vq '^ ' ;\
39ab2e4c 73 then revision=$${revision}M ;\
36230329
NS
74 fi ;\
75 else revision=unknown ;\
76 fi ;\
77 echo $$revision > $@
78
79revision: revision.stamp
80 @cmp -s $< $@ || cp -f $< $@
81
7a71ea4d
ML
82mostlyclean::
83
84clean:: mostlyclean
36230329
NS
85 rm -f revision.stamp revision
86
87distclean:: clean
88 rm -f config.log config.status
36230329 89
e2aa8a5f 90$(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/config.m4
36230329
NS
91 $(call MAINTAINER,$@,cd $(@D) && autoconf -W all,error)
92
e2aa8a5f 93$(srcdir)/config.h.in: $(srcdir)/configure.ac $(srcdir)/config.m4
36230329
NS
94 $(call MAINTAINER,$@,cd $(@D) && autoheader -f -W all,error)
95
96config.h: config.status config.h.in
97 ./$< --header=$@
98 touch $@
99
100ifeq ($(filter %clean,$(MAKECMDGOALS)),)
e2aa8a5f 101Makefile: config.status Makefile.in
36230329
NS
102 ./$< --file=$@
103 touch $@
104endif
105
106config.status: $(srcdir)/configure $(srcdir)/config.h.in
107 if test -x $@; then ./$@ -recheck; else $< @configure_args@; fi
108
7a71ea4d
ML
109mostlyclean::
110
111clean:: mostlyclean
112 rm -f $(shell find $(srcdir) -name '*~')
113
36230329
NS
114distclean:: clean
115 rm -f config.h
116
117maintainer-clean:: distclean
118 rm -f $(srcdir)/config.h.in
119
7a71ea4d 120.PHONY: all check clean distclean maintainer-clean mostlyclean
36230329 121
e2aa8a5f
NS
122CXXFLAGS/ := -I$(srcdir)
123LIBCODY.O := buffer.o client.o fatal.o netclient.o netserver.o \
124 resolver.o packet.o server.o
125
126all:: libcody.a
127
128libcody.a: $(LIBCODY.O)
129 $(AR) -cr $@ $^
130 $(RANLIB) $@
131
7a71ea4d
ML
132mostlyclean::
133
134clean:: mostlyclean
e2aa8a5f
NS
135 rm -f $(LIBCODY.O) $(LIBCODY.O:.o=.d)
136 rm -f libcody.a
137
138CXXFLAGS/fatal.cc = -DSRCDIR='"$(srcdir)"'
139
140fatal.o: Makefile revision
141
142install::
143 $(INSTALL) -d $(libdir) $(includedir)
144 $(INSTALL) libcody.a $(libdir)
145 $(INSTALL) $(srcdir)/cody.hh $(includedir)
36230329 146
e2aa8a5f
NS
147ifeq ($(filter clean%,$(MAKECMDGOALS)),)
148-include $(LIBCODY.O:.o=.d)
36230329 149endif