Mercurial > gemma
annotate Makefile @ 5714:98300739f761
Merged revive-cleanup branch into default.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 21 Feb 2024 14:27:07 +0100 |
parents | c23fa3d1824c |
children |
rev | line source |
---|---|
191
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
1 # Simple Makefile to build all of Gemma |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
2 # |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
3 # Authors: Sascha Wilde <wilde@intevation.de> |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
4 |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
5 basedir := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
6 |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
7 BUILDBASE := $(basedir).buildbase |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
8 GOPATH := $(BUILDBASE)/go |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
9 GOCACHE := $(BUILDBASE)/gocache |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
10 ENVWARPPER := $(BUILDBASE)/run-with-env.sh |
402
20d2edbc863d
Add install target for backend and use in Dockerfile
Tom Gottfried <tom@intevation.de>
parents:
303
diff
changeset
|
11 BINDIR := /usr/local/bin |
191
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
12 |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
13 export BUILDBASE |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
14 |
5701
c23fa3d1824c
Build meshmigrate via Makefile
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5606
diff
changeset
|
15 .PHONY: all gemma gmaggregate meshmigrate client clean |
191
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
16 |
5701
c23fa3d1824c
Build meshmigrate via Makefile
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5606
diff
changeset
|
17 all: gemma gmaggregate meshmigrate client |
191
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
18 |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
19 $(ENVWARPPER): |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
20 @echo "Preparing go build environment:" |
4464
707450608829
Get rid of (ugly) 3rdpartylibs.sh script. Use go modules.
Sascha Wilde <wilde@intevation.de>
parents:
4397
diff
changeset
|
21 mkdir -p "$(GOPATH)" |
191
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
22 mkdir -p "$(GOCACHE)" |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
23 @echo "Creating wrapper script:" |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
24 echo '#!/bin/sh' >"$(ENVWARPPER)" |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
25 echo 'export GOPATH=$(GOPATH)' >>"$(ENVWARPPER)" |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
26 echo 'export GOCACHE=$(GOCACHE)' >>"$(ENVWARPPER)" |
5606
5049f7ad9faa
Added optimization GOAMD64=v3 to build.
Sascha Wilde <wilde@sha-bang.de>
parents:
5548
diff
changeset
|
27 echo 'export GOAMD64=v3' >>"$(ENVWARPPER)" |
191
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
28 echo 'exec "$$@"' >>"$(ENVWARPPER)" |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
29 chmod +x "$(ENVWARPPER)" |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
30 |
4464
707450608829
Get rid of (ugly) 3rdpartylibs.sh script. Use go modules.
Sascha Wilde <wilde@intevation.de>
parents:
4397
diff
changeset
|
31 gemma: $(ENVWARPPER) |
707450608829
Get rid of (ugly) 3rdpartylibs.sh script. Use go modules.
Sascha Wilde <wilde@intevation.de>
parents:
4397
diff
changeset
|
32 "$(ENVWARPPER)" go build -o ./cmd/gemma/gemma ./cmd/gemma |
191
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
33 |
5548
02c2d0edeb2a
Added gmaggregate tool as contrib.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5400
diff
changeset
|
34 gmaggregate: $(ENVWARPPER) |
02c2d0edeb2a
Added gmaggregate tool as contrib.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5400
diff
changeset
|
35 cd ./contrib/gmaggregate; "$(ENVWARPPER)" go build |
02c2d0edeb2a
Added gmaggregate tool as contrib.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5400
diff
changeset
|
36 |
5701
c23fa3d1824c
Build meshmigrate via Makefile
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5606
diff
changeset
|
37 meshmigrate: $(ENVWARPPER) |
c23fa3d1824c
Build meshmigrate via Makefile
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5606
diff
changeset
|
38 cd ./cmd/meshmigrate; "$(ENVWARPPER)" go build |
c23fa3d1824c
Build meshmigrate via Makefile
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5606
diff
changeset
|
39 |
191
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
40 client: |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
41 $(MAKE) -f Makefile.build -C client |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
42 |
402
20d2edbc863d
Add install target for backend and use in Dockerfile
Tom Gottfried <tom@intevation.de>
parents:
303
diff
changeset
|
43 install: gemma |
20d2edbc863d
Add install target for backend and use in Dockerfile
Tom Gottfried <tom@intevation.de>
parents:
303
diff
changeset
|
44 cp cmd/gemma/gemma $(BINDIR) |
5701
c23fa3d1824c
Build meshmigrate via Makefile
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5606
diff
changeset
|
45 cp cmd/meshmigrate/meshmigrate $(BINDIR) |
5548
02c2d0edeb2a
Added gmaggregate tool as contrib.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5400
diff
changeset
|
46 cp contrib/gmaggregate/gmaggregate $(BINDIR) |
402
20d2edbc863d
Add install target for backend and use in Dockerfile
Tom Gottfried <tom@intevation.de>
parents:
303
diff
changeset
|
47 |
537
942a865986f6
Added simple build target for deployment tar.
Sascha Wilde <wilde@intevation.de>
parents:
402
diff
changeset
|
48 tar: all |
942a865986f6
Added simple build target for deployment tar.
Sascha Wilde <wilde@intevation.de>
parents:
402
diff
changeset
|
49 v="gemma-$$(hg id -i)" ;\ |
942a865986f6
Added simple build target for deployment tar.
Sascha Wilde <wilde@intevation.de>
parents:
402
diff
changeset
|
50 tar --transform "s@^@$${v}/@" \ |
942a865986f6
Added simple build target for deployment tar.
Sascha Wilde <wilde@intevation.de>
parents:
402
diff
changeset
|
51 -cJf "../$${v}.tar.xz" \ |
5548
02c2d0edeb2a
Added gmaggregate tool as contrib.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5400
diff
changeset
|
52 cmd/gemma/gemma \ |
5701
c23fa3d1824c
Build meshmigrate via Makefile
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5606
diff
changeset
|
53 cmd/meshmigrate/meshmigrate \ |
5548
02c2d0edeb2a
Added gmaggregate tool as contrib.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5400
diff
changeset
|
54 contrib/gmaggregate/gmaggregate \ |
02c2d0edeb2a
Added gmaggregate tool as contrib.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5400
diff
changeset
|
55 schema style-templates report-templates \ |
4664
7d2463c7b4ad
Added cmd/oct2str/oct2str to Makefile.
Sascha Wilde <wilde@intevation.de>
parents:
4494
diff
changeset
|
56 web misc example_conf.toml |
537
942a865986f6
Added simple build target for deployment tar.
Sascha Wilde <wilde@intevation.de>
parents:
402
diff
changeset
|
57 |
191
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
58 clean: |
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
59 $(MAKE) -f Makefile.build -C client $@ |
5548
02c2d0edeb2a
Added gmaggregate tool as contrib.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5400
diff
changeset
|
60 rm -f contrib/gmaggregate/gmaggregate |
5701
c23fa3d1824c
Build meshmigrate via Makefile
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5606
diff
changeset
|
61 rm -f cmd/meshmigrate/meshmigrate |
5548
02c2d0edeb2a
Added gmaggregate tool as contrib.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5400
diff
changeset
|
62 rm -f cmd/gemma/gemma |
4464
707450608829
Get rid of (ugly) 3rdpartylibs.sh script. Use go modules.
Sascha Wilde <wilde@intevation.de>
parents:
4397
diff
changeset
|
63 chmod -R u+w "$(BUILDBASE)" # This is neccessary for deletion to work... |
191
01c5794608e0
Added simple makefiles to build back end and client.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
64 rm -rf "$(BUILDBASE)" |