Skip to content

Commit 4cfcb3d

Browse files
committed
🧠 Improve Makefile some more.
1 parent 2ce7448 commit 4cfcb3d

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

‎Makefile

+16-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CC ?= cc
44
MOJILIST=https://raw.githubusercontent.com/milesj/emojibase/master/packages/data/en/raw.json
55

66
# Do not touch.
7-
all: moj
7+
all: moj libmoj.so
88

99
# Generate lookup lists
1010
gen/emoji.json:
@@ -32,28 +32,36 @@ gen/lookup.c: gen/emoji.gperf
3232

3333
# Compile our code.
3434
src/moj.o: gen/lookup.c gen/emoji_list.h src/moj.c
35-
$(CC) -c -o $@ ${CFLAGS} ${CPPFLAGS} src/moj.c
35+
$(CC) -c ${CFLAGS} ${CPPFLAGS} -o $@ src/moj.c
3636

3737
libmoj.so: src/moj.o
38-
$(CC) -shared -fPIC -o $@ ${LDFLAGS} $<
38+
$(CC) -shared -fPIC ${CFLAGS} ${CPPFLAGS} -o $@ ${LDFLAGS} $<
3939

4040
moj: src/main.c src/moj.o
41-
$(CC) -o $@ ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} $^
41+
$(CC) ${CFLAGS} ${CPPFLAGS} -o $@ ${LDFLAGS} $^
4242

4343
# Profanity plugin.
4444
profanity_emoji.so: src/profanity_emoji.c src/moj.o
45-
$(CC) -shared -fPIC -o $@ ${LDFLAGS} $^
45+
$(CC) -shared -fPIC ${CFLAGS} ${CPPFLAGS} -o $@ ${LDFLAGS} $^
4646

4747
profanity: profanity_emoji.so
4848

4949
# Install
50-
install: moj libmoj.so
50+
install: moj
51+
install -d $(DESTDIR)/$(PREFIX)/bin
5152
install moj $(DESTDIR)/$(PREFIX)/bin
53+
54+
install-devel: libmoj.so
55+
install -d $(DESTDIR)/$(PREFIX)/lib
5256
install libmoj.so $(DESTDIR)/$(PREFIX)/lib
57+
install -d $(DESTDIR)/$(PREFIX)/lib
58+
cp src/moj.h $(DESTDIR)/$(PREFIX)/include/libmoj.h
5359

5460
uninstall:
55-
cd $(DESTDIR)/$(PREFIX)/ && rm -f bin/moj lib/libmoj.so
56-
61+
rm -f $(DESTDIR)/$(PREFIX)/bin/moj
62+
uninstall-devel:
63+
rm -f $(DESTDIR)/$(PREFIX)/lib/libmoj.so $(DESTDIR)/$(PREFIX)/include/libmoj.h
64+
5765

5866
# Cleanup
5967
clean:

0 commit comments

Comments
 (0)