Add commentary and licence notices.
[rhodes] / Makefile
CommitLineData
ba147940
MW
1### -*-makefile-*-
2###
3### Build management
4###
5### (c) 2017 Mark Wooding
6###
7
8###----- Licensing notice ---------------------------------------------------
9###
10### This file is part of Rhodes, a distributed discrete-log finder.
11###
12### Rhodes is free software; you can redistribute it and/or modify
13### it under the terms of the GNU General Public License as published by
14### the Free Software Foundation; either version 2 of the License, or
15### (at your option) any later version.
16###
17### Rhodes is distributed in the hope that it will be useful,
18### but WITHOUT ANY WARRANTY; without even the implied warranty of
19### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20### GNU General Public License for more details.
21###
22### You should have received a copy of the GNU General Public License
23### along with Rhodes; if not, write to the Free Software Foundation,
24### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
a78da4e7
MW
26all::
27
ba147940
MW
28###--------------------------------------------------------------------------
29### What needs building.
30
a78da4e7
MW
31PROGS += rho
32rho_SRCS = rho.cc
33rho_LIBS = -lntl
34
35PROGS += factor
36factor_SRCS = factor.c
37factor_LIBS = -lpari
38
ba147940
MW
39###--------------------------------------------------------------------------
40### Common machinery.
41
a78da4e7
MW
42TARGETS =
43CLEAN += $(TARGETS)
44.SECONDEXPANSION:
45
46V = 0
47v_tag = $(call v_tag_$V,$1)
48v_tag_0 = @printf " %-6s %s\n" $1 $@;
49V_AT = $(V_AT_$V)
50V_AT_0 = @
51
52CC = gcc
53CFLAGS = -O2 -g -Wall -Werror
54CCLD = $(CC)
55LDFLAGS =
56CCLINK = $(call v_tag,CCLD)$(CCLD) $(LDFLAGS)
57
58AS = $(CC)
59
60CXX = g++
61CXXFLAGS = $(CFLAGS) -std=gnu++11
62CXXLD = $(CXX)
63CXXLINK = $(call v_tag,CXXLD)$(CXXLD) $(LDFLAGS)
64
65CLEAN += *.o *.d
66
67%.o: %.c
68 $(call v_tag,CC)$(CC) -c $(CFLAGS) -MD -o$@ $<
69
70%.o: %.cc
71 $(call v_tag,CXX)$(CXX) -c $(CXXFLAGS) -MD -o$@ $<
72
73objify = \
74 $(patsubst %.c,%.o, \
75 $(patsubst %.cc,%.o, \
76 $(patsubst %.s,%.o, $(patsubst %.S,%.o, \
77 $1))))
78
79TARGETS += $(PROGS)
80
81$(PROGS): %: $$(call objify,$$($$*_SRCS))
82 $(or $(and $(filter %.cc,$($*_SRCS)),$(CXXLINK)),$(CCLINK)) -o$@ \
83 $($*_LDFLAGS) $^ $($*_LIBS) $(LIBS)
84
85clean::
86 rm -f $(CLEAN)
87.PHONY: clean
88
89all:: $(TARGETS)
90.PHONY: all