summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2016-04-28 22:30:18 +0200
committerjaseg <code@jaseg.net>2016-04-28 22:40:14 +0200
commit9f3492f131cd6faac5c24e9c829f4f70a108ee26 (patch)
tree56d351d73105cdac7bee644186fd7b3488cbb4b3 /Makefile
parent64e25bef9c8e797f2c1af2f73b8faa6c46456fef (diff)
downloadlolcat-9f3492f131cd6faac5c24e9c829f4f70a108ee26.tar.gz
lolcat-9f3492f131cd6faac5c24e9c829f4f70a108ee26.tar.bz2
lolcat-9f3492f131cd6faac5c24e9c829f4f70a108ee26.zip
Compile dynamically linked executables on MacOS
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 16 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index f6aba9a..8cb68ba 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,14 @@
+LOLCAT_SRC = lolcat.c
+CENSOR_SRC = censor.c
+CFLAGS = -std=c11 -Wall
+
+ifeq ($(shell uname -s),Darwin)
+ LOLCAT_SRC += memorymapping/src/fmemopen.c
+ CENSOR_SRC += memorymapping/src/fmemopen.c
+ CFLAGS += -Imemorymapping/src
+endif
+
all: lolcat censor
.PHONY: install clean musl static
@@ -12,18 +22,18 @@ musl: musl/lib/libc.a musl/lib/crt1.o
static: lolcat-static censor-static
lolcat-static: lolcat.c musl
- gcc -c -std=c11 -Wall -Imusl/include -o lolcat.o $<
+ gcc -c $(CFLAGS) -Imusl/include -o lolcat.o $<
gcc -s -nostartfiles -nodefaultlibs -nostdinc -static -ffunction-sections -fdata-sections -Wl,--gc-sections -o $@ lolcat.o musl/lib/crt1.o musl/lib/libc.a
censor-static: censor.c musl
- gcc -c -std=c11 -Wall -Imusl/include -o censor.o $<
+ gcc -c $(CFLAGS) -Imusl/include -o censor.o $<
gcc -s -nostartfiles -nodefaultlibs -nostdinc -static -ffunction-sections -fdata-sections -Wl,--gc-sections -o $@ censor.o musl/lib/crt1.o musl/lib/libc.a
-lolcat: lolcat.c
- gcc -std=c11 -Wall -o $@ $<
+lolcat: $(LOLCAT_SRC)
+ gcc $(CFLAGS) -o $@ $^
-censor: censor.c
- gcc -std=c11 -Wall -o $@ $<
+censor: $(CENSOR_SRC)
+ gcc $(CFLAGS) -o $@ $^
install: lolcat censor
install lolcat /usr/local/bin