Skip to content
This repository was archived by the owner on May 24, 2024. It is now read-only.

Commit b072462

Browse files
committed
Merge pull request #1 from hasufell/master
BUILD: rework makefile
2 parents ad3d19b + 4cd5961 commit b072462

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
CFLAGS := -O2 -std=c++0x -Wall -fPIC -shared $(CFLAGS)
2-
CFLAGS += `pkg-config --libs --cflags mozjs185`
1+
CXX ?= g++
2+
PKG_CONFIG ?= pkg-config
3+
4+
CXXFLAGS ?= -O2
5+
CXXFLAGS += -std=c++0x -Wall -fPIC
6+
CXXFLAGS += $(shell $(PKG_CONFIG) --cflags mozjs185) \
7+
$(shell $(PKG_CONFIG) --cflags hexchat-plugin)
8+
LDFLAGS += -shared
9+
LIBS += $(shell $(PKG_CONFIG) --libs mozjs185)
310
OUTFILE := javascript.so
411

512
all:
6-
c++ $(CFLAGS) javascript.cpp -o $(OUTFILE)
13+
$(CXX) $(CXXFLAGS) $(LDFLAGS) javascript.cpp -o $(OUTFILE) $(LIBS)
714

815
clean:
916
rm $(OUTFILE)
1017

1118
install:
12-
install -m 644 -D $(OUTFILE) $(HOME)/.config/hexchat/addons/$(OUTFILE)
19+
install -m 755 -D $(OUTFILE) "$(DESTDIR)$(shell $(PKG_CONFIG) --variable=hexchatlibdir hexchat-plugin)/$(OUTFILE)"
1320

1421
uninstall:
15-
rm $(HOME)/.config/hexchat/addons/$(OUTFILE)
22+
rm "$(DESTDIR)$(shell $(PKG_CONFIG) --variable=hexchatlibdir hexchat-plugin 2>/dev/null)/$(OUTFILE)"
1623

0 commit comments

Comments
 (0)