-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (39 loc) · 1.22 KB
/
Makefile
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
SONAME=cygspawn
prefix=/usr/local
includedir=$(prefix)/include
exec_prefix=$(prefix)
bindir=$(exec_prefix)/bin
libdir=$(exec_prefix)/lib
DLLNAME=cyg$(SONAME).dll
IMPLIBNAME=lib$(SONAME).a
INSTALL=install -D
INSTALL_PROGRAM=$(INSTALL) -s
INSTALL_DATA=$(INSTALL) -m 0644
CFLAGS=-Os -Wall -g -Werror
CFLAGS+= -DNDEBUG
CFLAGS+=-Wno-unused-value
override CFLAGS+=-std=gnu99
.PHONY: all
all: $(DLLNAME) $(IMPLIBNAME) listvma testspawn.exe testfork.exe
cygspawn.o: cygspawn.c cygspawn.h
listvma: LDLIBS+=-lpsapi
listvma: listvma.o
testspawn.exe: testspawn.c $(IMPLIBNAME)
$(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS) $(LDLIBS)
testfork.exe: override CFLAGS+=-DUSE_FORK
testfork.exe: testspawn.c
$(CC) $(CFLAGS) -o $@ $+ $(LDLIBS)
$(DLLNAME) $(IMPLIBNAME): cygspawn.o cygspawn.def
gcc -shared -o $(DLLNAME) $(CFLAGS) \
-Wl,--out-implib=$(IMPLIBNAME) \
-Wl,--enable-auto-import \
-Wl,--no-whole-archive $+
.PHONY: clean
clean:
rm -f *.dll *.a *.o *.exe *.stackdump
.PHONY: install
install: $(DLLNAME) $(IMPLIBNAME) cygspawn.h
$(INSTALL_PROGRAM) $(DLLNAME) $(DESTDIR)$(bindir)/$(DLLNAME)
$(INSTALL_DATA) $(IMPLIBNAME) $(DESTDIR)$(libdir)/$(IMPLIBNAME)
$(INSTALL_DATA) cygspawn.h $(DESTDIR)$(includedir)/spawn.h
.DEFAULT_GOAL=all