summaryrefslogtreecommitdiffstats
path: root/diff_ext_for_kdiff3/Makefile
blob: 65177aa1b9d94eebdf6f00c3eef8c02a30dd6086 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
# Project: diff_ext
# Generates diff_ext_for_kdiff3.dll with gcc.
# Can be used for Cygwin and MingW (MingW ignores -mno-cygwin)
#
PROJ := diff_ext_for_kdiff3

CXX  ?= g++.exe

ifdef DEBUG
  CXXFLAGS ?= -g
else
  CXXFLAGS ?= -Os
  LDFLAGS += -s
endif
CXXFLAGS += -ansi -pedantic -Wall -W -D_UNICODE -DUNICODE

LIBS :=  -luuid -lole32
DEFFILE = $(PROJ).def
STATICLIB = $(PROJ).a
EXPLIB = $(PROJ).exp

SRC-CXX = $(wildcard *.cpp)
SRC-RC = $(wildcard *.rc)

OBJ  := $(SRC-CXX:.cpp=.o)
RES  := $(SRC-RC:.rc=.res)
OBJ += $(RES)
DLL  := $(PROJ).dll

.PHONY: all clean

.SUFFIXES: .rc .res

all: .depend $(DLL)

debug:
	$(MAKE) DEBUG=YES UNICODE=YES

release:
	$(MAKE) 

.depend: Makefile $(SRC-RC) $(SRC-CXX)
	$(CXX) -M $(CXXFLAGS) $(SRC-RC) $(SRC-CXX) > .depend
	
include .depend

clean: clean-custom
	${RM}  $(OBJ) $(DLL) ${EXPLIB} $(STATICLIB)

$(DLL): $(OBJ)
	dllwrap.exe \
		--mno-cygwin \
		--def $(DEFFILE) \
		--output-exp ${EXPLIB} \
		--driver-name c++ -L/usr/local/lib -L/usr/lib/mingw \
		--implib $(STATICLIB) \
		$(OBJ) $(LDFLAGS) $(LIBS) \
		-o $@

.cpp.o:
	$(CXX) $(CXXFLAGS) -c $< -o $@ 

.rc.res:
	windres.exe  $< -J rc -o $@ -O coff -DMING