summaryrefslogtreecommitdiff
path: root/odk/examples/dotnet/WriterDemo/vbasic/Makefile
blob: 01014c71a82080f67c4919cd366728d6b37d30b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Builds the WriterDemo example of the Developers Guide.

PRJ = ../../../..
SETTINGS = $(PRJ)/settings

include $(SETTINGS)/settings.mk
include $(SETTINGS)/std.mk

# Settings
APP_NAME = WriterDemo
APP_LANG = vb

APP_SRC_DIR = $(subst /,$(PS),$(CURDIR))
APP_BIN_DIR = $(subst /,$(PS),$(OUT_BIN))
APP_MISC_DIR = $(subst /,$(PS),$(OUT_MISC)/$(APP_NAME))

APP_PROJ_NAME = $(APP_NAME).$(APP_LANG)proj
APP_PROJ_FILE = $(APP_MISC_DIR)/$(APP_PROJ_NAME)

APP_EXE_NAME = $(APP_NAME)$(EXE_EXT)
APP_EXE_FILE = $(APP_BIN_DIR)/$(APP_EXE_NAME)

DOTNET_FLAGS = -c Release
LO_NUPKG_ID = LibreOffice.Bindings
LO_NUPKG_VERSION = 0.1.0
LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)

# Targets
.PHONY: ALL
ALL : $(APP_NAME)

include $(SETTINGS)/stdtarget.mk

$(APP_PROJ_FILE) :
	-$(MKDIR) $(@D)
	$(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
	$(ECHO) "    <PropertyGroup>" >> $@
	$(ECHO) "        <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
	$(ECHO) "        <TargetFramework>net8.0</TargetFramework>" >> $@
	$(ECHO) "        <OutputType>exe</OutputType>" >> $@
	$(ECHO) "        <PublishSingleFile>true</PublishSingleFile>" >> $@
	$(ECHO) "        <SelfContained>false</SelfContained>" >> $@
	$(ECHO) "        <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>" >> $@
	$(ECHO) "        <RestoreAdditionalProjectSources>$(LO_NUPKG_DIR)</RestoreAdditionalProjectSources>" >> $@
	$(ECHO) "    </PropertyGroup>" >> $@
	$(ECHO) "    <ItemGroup>" >> $@
	$(ECHO) "        <PackageReference Include=\"$(LO_NUPKG_ID)\" Version=\"$(LO_NUPKG_VERSION)\" />" >> $@
	$(ECHO) "        <Compile Include=\"$(APP_SRC_DIR)/*.$(APP_LANG)\" />" >> $@
	$(ECHO) "    </ItemGroup>" >> $@
	$(ECHO) "</Project>" >> $@
	$(ECHOLINE) >> $@

$(APP_EXE_FILE) : $(APP_PROJ_FILE)
	-$(MKDIR) $(@D)
	$(SDK_DOTNET) publish $< $(DOTNET_FLAGS) -o $(<D)
	$(COPY) $(<D)/$(APP_EXE_NAME) $@

.PHONY: $(APP_NAME)
$(APP_NAME) : $(APP_EXE_FILE)
	$(ECHO) --------------------------------------------------------
	$(ECHO) Use the following commands to run the example:
	$(ECHO) $(MAKE) run OR $(MAKE) $(APP_NAME).run
	$(ECHO)
	$(ECHO) And the following commands to clean the example:
	$(ECHO) $(MAKE) clean OR $(MAKE) $(APP_NAME).clean
	$(ECHO) --------------------------------------------------------

.PHONY: $(APP_NAME).run run
$(APP_NAME).run run : $(APP_EXE_FILE)
	cd $(<D) && ./$(<F)

.PHONY: $(APP_NAME).clean clean
$(APP_NAME).clean clean :
	-$(DELRECURSIVE) $(APP_MISC_DIR)
	-$(DEL) $(APP_EXE_FILE)