### -*-makefile-*- ### ### Build management ### ### (c) 2017 Mark Wooding ### ###----- Licensing notice --------------------------------------------------- ### ### This file is part of Rhodes, a distributed discrete-log finder. ### ### Rhodes is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. ### ### Rhodes is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### You should have received a copy of the GNU General Public License ### along with Rhodes; if not, write to the Free Software Foundation, ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. all:: ###-------------------------------------------------------------------------- ### What needs building. PROGS += rho rho_SRCS = rho.cc rho_LIBS = -lntl PROGS += factor factor_SRCS = factor.c factor_LIBS = -lpari ###-------------------------------------------------------------------------- ### Common machinery. TARGETS = CLEAN += $(TARGETS) .SECONDEXPANSION: V = 0 v_tag = $(call v_tag_$V,$1) v_tag_0 = @printf " %-6s %s\n" $1 $@; V_AT = $(V_AT_$V) V_AT_0 = @ CC = gcc CFLAGS = -O2 -g -Wall -Werror CCLD = $(CC) LDFLAGS = CCLINK = $(call v_tag,CCLD)$(CCLD) $(LDFLAGS) AS = $(CC) CXX = g++ CXXFLAGS = $(CFLAGS) -std=gnu++11 CXXLD = $(CXX) CXXLINK = $(call v_tag,CXXLD)$(CXXLD) $(LDFLAGS) CLEAN += *.o *.d %.o: %.c $(call v_tag,CC)$(CC) -c $(CFLAGS) -MD -o$@ $< %.o: %.cc $(call v_tag,CXX)$(CXX) -c $(CXXFLAGS) -MD -o$@ $< objify = \ $(patsubst %.c,%.o, \ $(patsubst %.cc,%.o, \ $(patsubst %.s,%.o, $(patsubst %.S,%.o, \ $1)))) TARGETS += $(PROGS) $(PROGS): %: $$(call objify,$$($$*_SRCS)) $(or $(and $(filter %.cc,$($*_SRCS)),$(CXXLINK)),$(CCLINK)) -o$@ \ $($*_LDFLAGS) $^ $($*_LIBS) $(LIBS) clean:: rm -f $(CLEAN) .PHONY: clean all:: $(TARGETS) .PHONY: all