Makefile: lifemngr: split linux and windows build
* Split linux and windows build of lifemngr to be able to build them independently. * Install life_mngr.service * Avoid the following Makefile error output by explicitly checking Windows cross compiler availability: make[4]: x86_64-w64-mingw32-gcc: Command not found make[4]: [Makefile:47: all-win] Error 127 (ignored) Tracked-On: #5660 Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
This commit is contained in:
parent
b673bc36b1
commit
e88955392f
|
@ -37,12 +37,24 @@ LIFEMNGR_LDFLAGS += -Wl,-z,relro,-z,now
|
|||
LIFEMNGR_LDFLAGS += -pie
|
||||
LIFEMNGR_LDFLAGS += $(LDFLAGS)
|
||||
|
||||
all:
|
||||
# set cross compiler for Windows
|
||||
MINGWIN_CC := x86_64-w64-mingw32-gcc
|
||||
|
||||
all: all-linux all-win
|
||||
|
||||
all-linux:
|
||||
$(CC) -g life_mngr.c -o $(OUT_DIR)/life_mngr -lpthread $(LIFEMNGR_CFLAGS) $(LIFEMNGR_LDFLAGS)
|
||||
cp life_mngr.service $(OUT_DIR)/life_mngr.service
|
||||
|
||||
-x86_64-w64-mingw32-gcc -g life_mngr_win.c -o $(OUT_DIR)/life_mngr_win.exe -Wall -O2 $(LDFLAGS)
|
||||
# only build for Windows if cross compiler is installed
|
||||
ifneq ($(shell which $(MINGWIN_CC)),)
|
||||
all-win:
|
||||
$(MINGWIN_CC) -g life_mngr_win.c -o $(OUT_DIR)/life_mngr_win.exe -Wall -O2 $(LDFLAGS)
|
||||
cp COPYING.MinGW-w64-runtime.txt $(OUT_DIR)/COPYING.MinGW-w64-runtime.txt
|
||||
else
|
||||
all-win:
|
||||
@echo "WARN: $(MINGWIN_CC) not installed, skipping life_mngr_win.exe" >&2
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f $(OUT_DIR)/life_mngr
|
||||
|
@ -55,3 +67,4 @@ endif
|
|||
install:
|
||||
install -d $(DESTDIR)/usr/bin
|
||||
install -t $(DESTDIR)/usr/bin $(OUT_DIR)/life_mngr
|
||||
install -p -D -m 0644 $(OUT_DIR)/life_mngr.service $(DESTDIR)$(systemd_unitdir)/system/
|
||||
|
|
Loading…
Reference in New Issue