-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (24 loc) · 717 Bytes
/
Copy pathMakefile
File metadata and controls
30 lines (24 loc) · 717 Bytes
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
GHC = ghc
C2HS = c2hs
ifeq ($(LINK_STATICALLY),YES)
LIBS=-lHSrts_thr -lCffi
GHCFLAGS = -fPIC -optc-fPIC
else
LIBS=-lHSrts_thr-ghc$(shell ghc --numeric-version)
GHCFLAGS=-dynamic
endif
PG_INCLUDE = $(shell pg_config --includedir-server)
CFLAGS += -I$(PG_INCLUDE)
GHCFLAGS += $(CFLAGS) -Wall -O2
all: schedule.so
schedule.so: schedule.c hsbracket.c PGSchedule.hs
PGSchedule_stub.h: PGSchedule.hs
schedule.c: PGSchedule_stub.h
%.hs: %.chs
$(C2HS) -C "-I$(PG_INCLUDE)" $^
%.so:
$(GHC) --make -shared $(GHCFLAGS) $^ -o $@ $(LIBS) -fforce-recomp
%_stub.h:
$(GHC) --make -c $(CFLAGS) -O0 $<
clean:
rm -rf *.o *.dyn_o *.hi *.dyn_hi *.so *_o_split *_stub.h .cabal-sandbox cabal.sandbox.config PGSchedule.hs