-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrules.mk
More file actions
19 lines (16 loc) · 714 Bytes
/
rules.mk
File metadata and controls
19 lines (16 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
RES_FOLDER = res
RES_FILES = $(call filter-files, $(call rwildcard, $(RES_FOLDER), *))
RES_DFILE = $(BUILDDIR)/res.dat
ifneq ($(RES_FILES),)
$(RES_DFILE): $(RES_FILES)
@$(info $(DCYAN_COLOR)[+] Wrapping$(NO_COLOR) $(DYELLOW_COLOR)$(RES_FOLDER)/$(NO_COLOR))
$(showcmd)tar -C $(RES_FOLDER) -cf $@ $(subst $(RES_FOLDER)/,,$(wildcard $(RES_FOLDER)/*))
$(RES_DFILE)$(OBJEXT): $(RES_DFILE)
ifneq ($(HOST_OS), Darwin)
$(showcmd)cd $(@D) && ld -r -b binary -o $(@F) $(basename $(@F))
else
$(showcmd)cd $(@D) && echo "int _res_stub = 0;" > res_stub.c && gcc -o res_stub.o -c res_stub.c
$(showcmd)ld -r -o $@ -sectcreate __DATA __res_dat $(RES_DFILE) $(@D)/res_stub.o
endif
OBJ_$(D) += $(RES_DFILE)$(OBJEXT)
endif