# Copyright 2015 Luke Shumaker . # # This 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. # # The GNU General Public License's references to "object code" and # "executables" are to be interpreted to also include the output of # any document formatting or typesetting system, including # intermediate and printed output. # # This software 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 this manual; if not, see # . PACKAGE = parabola-hackers systemddir = $(libdir)/systemd conf_file = $(sysconfdir)/$(PACKAGE).yml NET ?= #NET ?= FORCE user = nshd group = nshd CFLAGS = -Wall -Wextra -Werror -pedantic CC = gcc -std=c99 MAKEFLAGS += --no-builtin-rules topsrcdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) topoutdir := $(topsrcdir) include $(topsrcdir)/build-aux/Makefile.head.mk CGO_CFLAGS = $(CFLAGS) -Wno-unused-parameter CGO_ENABLED = 1 at.subdirs += src/lukeshu.com/git/go/libnslcd.git/proto scripts = $(notdir $(wildcard $(srcdir)/scripts/*)) std.gen_files += LICENSE.lgpl-2.1.txt LICENSE.gpl-2.txt LICENSE.apache-2.0.txt std.out_files += bin/nshd nshd.service nshd.socket test/runner std.sys_files += $(addprefix $(bindir)/,nshd $(scripts)) $(systemddir)/system/nshd.socket $(systemddir)/system/nshd.service std.clean_files += test/*.o pkg/ $(srcdir)/LICENSE.lgpl-2.1.txt: $(NET) curl https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt > $@ $(srcdir)/LICENSE.gpl-2.txt: $(NET) curl https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt > $@ $(srcdir)/LICENSE.apache-2.0.txt: $(NET) curl https://www.apache.org/licenses/LICENSE-2.0 > $@ $(srcdir)/LICENSE.wtfpl-2.txt: $(NET) curl http://www.wtfpl.net/txt/copying/ > $@ $(outdir)/bin/nshd: private golang.FLAGS+=-ldflags '-X nshd.conf_file=$(conf_file)' $(outdir)/bin/nshd: src/lukeshu.com/git/go/libnslcd.git/proto/server/interface_backend.go $(outdir)/bin/nshd: src/lukeshu.com/git/go/libnslcd.git/proto/server/func_handlerequest.go $(outdir)/bin/nshd: src/lukeshu.com/git/go/libnslcd.git/proto/server/type_nilbackend.go $(outdir)/bin/nshd: $(call golang.src,$(srcdir)) $(var)conf_file $(call golang.install,$(topsrcdir),nshd) $(outdir)/%.o: $(srcdir)/%.c $(var)CC $(var)CPPFLAGS $(var)CFLAGS $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(filter-out $(var)%,$^) $(outdir)/%: $(outdir)/%.o $(var)CC $(var)LDFLAGS $(CC) $(LDFLAGS) -o $@ $(filter-out $(var)%,$^) $(outdir)/%: $(srcdir)/%.in < $< sed $(foreach v,$(patsubst $(var)%,%,$(filter $(var)%,$^)), -e 's|@$v@|$($v)|g' ) > $@ $(outdir)/nshd.service: $(var)user $(var)group $(var)bindir $(outdir)/nshd.socket: $(var)user $(var)group $(DESTDIR)$(bindir)/%: $(outdir)/bin/% install -TDm755 $< $@ $(DESTDIR)$(bindir)/%: $(srcdir)/scripts/% install -TDm755 $< $@ $(DESTDIR)$(bindir)/common.rb: $(srcdir)/scripts/common.rb install -TDm644 $< $@ $(DESTDIR)$(systemddir)/system/%.socket: $(outdir)/%.socket install -TDm644 $< $@ $(DESTDIR)$(systemddir)/system/%.service: $(outdir)/%.service install -TDm644 $< $@ .PHONY: FORCE .SECONDARY: .DELETE_ON_ERROR: include $(topsrcdir)/build-aux/Makefile.tail.mk