Page MenuHomec4science

Makefile
No OneTemporary

File Metadata

Created
Tue, Nov 26, 07:59

Makefile

TARGET = oncilla-sim-wizard
ALL_SOURCES = $(wildcard *.go)
DESTDIR ?=
PREFIX ?= /usr/local
# Remove man.go
SOURCES = $(subst man.go,,$(ALL_SOURCES))
MAN_SOURCES = $(subst oncilla-sim-wizard.go,man.go,$(SOURCES))
INSTALLDIR = $(DESTDIR)$(PREFIX)
VERBOSE ?=
ifneq ($(V),)
vecho =
veecho =
else
vecho = @echo [$1] $2;
veecho = echo [$1] $2;
endif
GC ?= go
# RESOURCES = $(wildcard resources/*)
# SECTIONS = $(foreach i,$(RESOURCES),--add-section autobuild_res_$(notdir $(i))=$(i))
MANINSTALLDIR = $(INSTALLDIR)/share/man/man1
all: $(TARGET) $(TARGET).man
# previous was
#$(TARGET): $(SOURCES) $(RESOURCES)
# $(call vecho,GC,$@) $(GC) build -o $@ $(SOURCES) && \
# objcopy $(SECTIONS) $(TARGET)
$(TARGET): $(SOURCES) $(RESOURCES)
$(call vecho,GC,$@) $(GC) build -o $@ $(SOURCES) && \
objcopy $(SECTIONS) $(TARGET)
CLEANFILES = $(TARGET) $(TARGET).man .gen-man
clean:
$(call vecho,CLEAN,$(CLEANFILES)) rm -f $(CLEANFILES)
install: $(TARGET) $(TARGET).man
test -z "$(INSTALLDIR)/bin" || mkdir -p "$(INSTALLDIR)/bin" && \
install -c $(TARGET) "$(INSTALLDIR)/bin"; \
test -z "$(MANINSTALLDIR)" || mkdir -p "$(MANINSTALLDIR)" && \
install -c -m 644 $(TARGET).man "$(MANINSTALLDIR)/$(TARGET).1"
uninstall:
rm -f "$(INSTALLDIR)/bin/$(TARGET)"; \
rm -f "$(MANINSTALLDIR)/$(TARGET).1"
.gen-man: $(MAN_SOURCES)
$(call vecho,GC,$@) $(GC) build -o $@ $(MAN_SOURCES)
$(TARGET).man: .gen-man
$(call vecho,MAN,$@) ./.gen-man > $@
.PHONY: install clean all

Event Timeline