
AUTOMAKE_OPTIONS = foreign no-dependencies no-installinfo

SUBDIRS = rc

SUFFIXES = .go
OBJEXT= none

if DEV_MODE
noinst_PROGRAMS = engined
else
sbin_PROGRAMS = engined
endif
engined_SOURCES = cmd/engined/main.go

EXTRA_engined_SOURCES = \
	internal/config/path.go.in
	internal/config/config.go \
	internal/config/path.go \
	internal/handler/handler.go \
	internal/iotype/iotype.go \
	internal/logger/logger.go \
	internal/logic/logic.go \
	internal/server/server.go \
	internal/service/corsmw.go \
	internal/service/logmw.go \
	internal/service/service.go \
	pkg/auxtool/aux509/genpair.go \
	pkg/auxtool/auxhttp/genres.go

GOFLAGS = -v

engined$(EXEEXT): $(engined_SOURCES) $(EXTRA_engined_SOURCES)
	$(GO) build $(GOFLAGS) -o engined$(EXEEXT) $(engined_SOURCES)

EXTRA_DIST = $(EXTRA_engined_SOURCES) 

distclean-local:
	rm -rf autom4te.cache

clean-local:
	rm -rf autom4te.cache
	rm -f cmd/engined/engined
	rm -f cmd/engined/main

format:
	for dir in $$(find internal pkg cmd -type d); do \
	  (cd $$dir && $(GO) fmt .); \
	done

run:
	$(GO) run -v ./cmd/engined/...



if DEV_MODE
install-data-local:
else
install-data-local:
	$(MKDIR_P) $(DESTDIR)$(SRV_SHAREDIR)
	$(CP) -R share $(DESTDIR)$(SRV_SHAREDIR)
endif

