-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (30 loc) · 940 Bytes
/
Makefile
File metadata and controls
40 lines (30 loc) · 940 Bytes
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
# Typewriter - lightweight text editor
# Requires: SDL2, SDL2_ttf
CC ?= gcc
WINDRES ?= windres
CFLAGS ?= -O2 -Wall -Wextra -Wno-unused-parameter -Wno-format-truncation
LDFLAGS ?=
SDL_CFLAGS := $(shell pkg-config --cflags sdl2 SDL2_ttf 2>/dev/null)
SDL_LIBS := $(shell pkg-config --libs sdl2 SDL2_ttf 2>/dev/null)
# Fallback if pkg-config not available
ifeq ($(SDL_CFLAGS),)
SDL_CFLAGS = -I/usr/include/SDL2
SDL_LIBS = -lSDL2 -lSDL2_ttf
endif
TARGET = typewriter
OBJS = main.c
RES =
ifeq ($(OS),Windows_NT)
TARGET = typewriter.exe
LDFLAGS += -mwindows -lcomdlg32
RES = typewriter_res.o
endif
all: $(TARGET)
# Windows resource (embeds icon.ico into the exe)
typewriter_res.o: typewriter.rc icon.ico
$(WINDRES) typewriter.rc -o typewriter_res.o
$(TARGET): main.c $(RES)
$(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ main.c $(RES) $(SDL_LIBS) $(LDFLAGS) -lm
clean:
rm -f $(TARGET) typewriter_res.o
.PHONY: all clean