-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (36 loc) · 1.04 KB
/
Makefile
File metadata and controls
47 lines (36 loc) · 1.04 KB
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
TARGET := hackplayer
SRC := main.c
CC ?= cc
UNAME_S := $(shell uname -s 2>/dev/null)
CFLAGS_COMMON := -O2 -Wall -Wextra -std=gnu2x
LDFLAGS_COMMON :=
CFLAGS := $(CFLAGS_COMMON)
LDFLAGS := $(LDFLAGS_COMMON)
ifeq ($(OS),Windows_NT)
TARGET := hackplayer.exe
CFLAGS += -D_WIN32
LDFLAGS += -lwinmm -lgdi32 -lkernel32
else ifeq ($(UNAME_S),Linux)
CFLAGS += -D_LINUX
LDFLAGS += -lm -lpthread -ldl
else ifeq ($(UNAME_S),FreeBSD)
CFLAGS += -D_FREEBSD -I/usr/local/include
LDFLAGS += -lm -lpthread
else
CFLAGS += -D_POSIX
LDFLAGS += -lm -lpthread
endif
.PHONY: all clean deps run
all: $(TARGET)
$(TARGET): $(SRC) miniaudio.h
$(CC) $(CFLAGS) -o $@ $(SRC) $(LDFLAGS)
deps:
ifeq ($(OS),Windows_NT)
powershell -NoProfile -Command "Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/mackron/miniaudio/master/miniaudio.h -OutFile miniaudio.h"
else
curl -fsSL https://raw.githubusercontent.com/mackron/miniaudio/master/miniaudio.h -o miniaudio.h
endif
run: $(TARGET)
./$(TARGET)
clean:
rm -f hackplayer hackplayer.exe