~melchizedek6809/WolkenWelten

ref: e910bd82e598d6f560b8899dd1d88fb3ed554cd3 WolkenWelten/common/common.mk -rw-r--r-- 4.4 KiB
e910bd82Ben (X13/Arch) Updated contact info 8 months ago
                                                                                
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
ARCH             := $(shell uname -m)
NUJ_WWLIB        := $(shell find common/src/nuj/ -type f -name '*.nuj' | sort)
COMMON_ASSETS    := common/src/tmp/wwlib.nuj
COMMON_HDRS      := $(shell find common/src -type f -name '*.h')
COMMON_SRCS      := $(shell find common/src -type f -name '*.c')
COMMON_OBJS      := ${COMMON_SRCS:.c=.o}
COMMON_DEPS      := ${COMMON_SRCS:.c=.d}
ASM_OBJS         :=

WEBEXCLUDE       += --exclude=releases/macos/wolkenwelten.iconset/
WEBEXCLUDE       += --exclude=releases/win/*.res

TEST_WORLD       := -worldSeed=68040 -savegame=Test

ASM_SRCS         := common/src/asm/$(ARCH).s

ifneq ("$(wildcard $(ASM_SRCS))","")
	ASM_OBJS := ${ASM_SRCS:.s=.o}
else
	ASM_SRCS :=
endif

$(COMMON_OBJS): | client/src/tmp/objs.h
$(COMMON_OBJS): | client/src/tmp/sfx.h
$(COMMON_OBJS): | common/src/tmp/assets.h
$(COMMON_OBJS): | server/src/tmp/assets.h
$(COMMON_OBJS): | server/src/tmp/objs.h
$(COMMON_OBJS): | server/src/tmp/sfx.h

common/nujel/nujel.a: $(NUJEL)

%.o: %.s
	@$(AS) $(ASFLAGS) -c --defsym $(AS_SYM) $< -o $@
	@echo "$(ANSI_BLUE)" "[AS] " "$(ANSI_RESET)" $@

%.o: %.c
	@$(CC) $(OPTIMIZATION) $(WARNINGS) $(CSTD) $(CFLAGS) $(CINCLUDES) $(if $(findstring client/, $<),$(CLIENT_CFLAGS) $(CLIENT_CINCLUDES),) -g -c $< -o $@ -MMD > ${<:.c=.d}
	@echo "$(ANSI_GREEN)" "[CC] " "$(ANSI_RESET)" $@

common/src/tmp/wwlib.nuj: $(NUJ_WWLIB)
	@mkdir -p common/src/tmp
	@cat $(NUJ_WWLIB) > $@
	@echo "$(ANSI_GREY)" "[CAT]" "$(ANSI_RESET)" $@

common/src/tmp/assets.c: $(ASSET) $(COMMON_ASSETS)
	@mkdir -p common/src/tmp/
	@$(ASSET) common/src/tmp/assets $(COMMON_ASSETS)
	@echo "$(ANSI_GREY)" "[ST] " "$(ANSI_RESET)" $@
common/src/tmp/assets.h: common/src/tmp/assets.c
	@true

$(ASSET): tools/assets.c
	@$(CC) $(OPTIMIZATION) $(CSTD) $(CFLAGS) $^ -o $@
	@echo "$(ANSI_BG_GREY)" "[CC] " "$(ANSI_RESET)" $@

.PHONY: clean
clean:
	@$(MAKE) -C common/nujel clean
	@rm -f gmon.out client/tools/assets client/tools/objparser callgrind.out.* vgcore.* platform/win/wolkenwelten.res
	@rm -f client/sfx/*.ogg
	@rm -f $(shell find client/src common/src server/src -type f -name '*.o')
	@rm -f $(shell find client/src common/src server/src -type f -name '*.wo')
	@rm -f $(shell find client/src common/src server/src -type f -name '*.d')
	@rm -f $(shell find client/src common/src server/src -type f -name '*.wd')
	@rm -f $(shell find client/src common/src server/src -type f -name '*.deps')
	@rm -f wolkenwelten wolkenwelten.exe wolkenwelten-server wolkenwelten-server.exe tools/assets nujel nujel.exe
	@rm -f server/make.deps client/make.deps common/make.deps server/server.d client/client.d common/common.d nujel-standalone/nujel.d
	@rm -rf client/src/tmp server/src/tmp common/src/tmp web/releases releases nujel-standalone/tmp
	@echo "$(ANSI_BG_RED)" "[CLEAN]" "$(ANSI_RESET)" "wolkenwelten"

.PHONY: web
web:
	rsync -avhe ssh web/ wolkenwelten.net:/var/www/html/
	ssh wolkenwelten.net "mkdir -p /var/www/html/releases && cd /var/www/html/releases && mkdir -p win macos linux-x86_64 linux-aarch64 linux-armv7l"
	if [ -d "releases/wasm" ]; then rsync -avhe ssh releases/wasm/ wolkenwelten.net:/var/www/html/releases/wasm/ ; fi
	if [ -d "releases/win" ]; then rsync -avhe ssh releases/win/*.7z wolkenwelten.net:/var/www/html/releases/win/ ; fi
	if [ -d "releases/macos" ]; then rsync -avhe ssh releases/macos/*.tgz wolkenwelten.net:/var/www/html/releases/macos/ ; fi
	if [ -d "releases/linux-armv7l" ]; then rsync -avhe ssh releases/linux-armv7l/*.xz wolkenwelten.net:/var/www/html/releases/linux-armv7l/ ; fi
	if [ -d "releases/linux-aarch64" ]; then rsync -avhe ssh releases/linux-aarch64/*.xz wolkenwelten.net:/var/www/html/releases/linux-aarch64/ ; fi
	if [ -d "releases/linux-x86_64" ]; then rsync -avhe ssh releases/linux-x86_64/*.xz wolkenwelten.net:/var/www/html/releases/linux-x86_64/ ; fi
	ssh wolkenwelten.net "cd /var/www/html/ && guile template.scm"

.PHONY: website
website:
	rsync -avhe ssh web/ wolkenwelten.net:/var/www/html/
	ssh wolkenwelten.net "cd /var/www/html/ && guile template.scm"

.PHONY: debug
debug: CFLAGS += -O0
debug: all

.PHONY: profile
profile: CFLAGS += -pg
profile: all

.PHONY: sanitize
sanitize: CFLAGS += -fsanitize=address
sanitize: all

.PHONY: archive
archive:
	git archive --format=tar --prefix=wolkenwelten-HEAD.tar.gz/ HEAD | gzip > wolkenwelten-HEAD.tar.gz

common/src/tmp/cto.c: tools/tools.nuj $(NUJEL)
	@mkdir -p common/src/tmp/
	@$(NUJEL) tools/tools.nuj -x "[infogen \"common/src/tmp/cto\"]"
	@echo "$(ANSI_GREY)" "[NUJ]" "$(ANSI_RESET)" $@