3 ifneq ($(findstring Windows,$(OS)),)
5 CFLAGS=/O2 /D_CRT_SECURE_NO_WARNINGS
6 JATTACH_EXE=jattach.exe
8 UNAME_S:=$(shell uname -s)
9 ifneq ($(findstring FreeBSD,$(UNAME_S)),)
14 ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
15 RPM_ROOT=$(ROOT_DIR)/build/rpm
16 SOURCES=$(RPM_ROOT)/SOURCES
17 SPEC_FILE=jattach.spec
24 all: build build/$(JATTACH_EXE)
29 build/jattach: src/jattach_posix.c
30 $(CC) $(CFLAGS) -DJATTACH_VERSION=\"$(JATTACH_VERSION)\" -o $@ $^
32 build/jattach.exe: src/jattach_windows.c
33 $(CL) $(CFLAGS) /DJATTACH_VERSION=\"$(JATTACH_VERSION)\" /Fobuild/jattach.obj /Fe$@ $^ advapi32.lib /link /SUBSYSTEM:CONSOLE,5.02
42 mkdir -p $(RPM_ROOT)/SPECS
43 mkdir -p $(SOURCES)/bin
44 mkdir -p $(RPM_ROOT)/BUILD
45 mkdir -p $(RPM_ROOT)/SRPMS
46 mkdir -p $(RPM_ROOT)/RPMS
47 mkdir -p $(RPM_ROOT)/tmp
49 rpm: rpm-dirs build build/$(JATTACH_EXE)
50 cp $(SPEC_FILE) $(RPM_ROOT)/
51 cp build/jattach $(SOURCES)/bin/
53 --define '_topdir $(RPM_ROOT)' \
54 --define '_tmppath $(RPM_ROOT)/tmp' \
58 --buildroot $(RPM_ROOT)/tmp/build-root \
59 $(RPM_ROOT)/jattach.spec