-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathMakefile.gcw0
87 lines (70 loc) · 2.35 KB
/
Makefile.gcw0
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#Makefile for wizznic.
#To make a system-wide install add DATADIR=/dir/to/data/ and BINDIR=/dir/to/bin/ to the make command
#To compile without OpenGL scaling support, add WITH_OPENGL=false to the make command.
WITH_OPENGL := false
CROSS_COMPILE := /opt/gcw0-toolchain/usr/bin/mipsel-linux-
CC = $(CROSS_COMPILE)gcc
LD = $(CC)
STRIP = $(CROSS_COMPILE)strip
SYSROOT := $(shell $(CC) --print-sysroot)
OPKNAME := "wizznic"
NAME=wizznic
TARGET= $(NAME).elf
ifeq ($(DATADIR),)
DATADIR="./"
endif
DEFS = -DGCW0 -DIS_LITTLE_ENDIAN -DDATADIR="\"$(DATADIR)\"" -DPER_USER_FILES -D_BSD_SOURCE -D__USE_BSD
#default to /usr/share/man for man page
#note: some systems use /usr/local/share/man, others use /usr/local/man
#packagers should set the variable accordingly
MANDIR = /man/
DESTDIR := ./opk/
ifneq ($(BUILD_NUMBER),)
DEFS +=-DBUILD_NUMBER="\"$(BUILD_NUMBER)\""
endif
INCS = -I. -I$(SYSROOT)/usr/include -I$(SYSROOT)/usr/include/SDL
CFLAGS=-Wall -Wextra -std=c99
ifeq ($(DEBUG),)
CFLAGS += -O3
else
STRIP = true
CFLAGS += -g
endif
LDFLAGS=$(CFLAGS)
LIBS = -lSDL -lSDL_image -lSDL_mixer -lm -lpthread
#Are we compiling with gl?
ifneq ($(WITH_OPENGL),false)
LIBS += -lGL
DEFS += -DWITH_OPENGL
endif
SOURCES = $(wildcard src/*.c) src/platform/pc.c\
src/platform/dumplevelimages.c src/platform/libDLC.c\
src/list/list.c
OBJS = $(SOURCES:.c=.o)
MYCC = $(CC) $(CFLAGS) $(INCS) $(DEFS)
########################################################################
all: $(TARGET)
$(TARGET): $(OBJS)
$(LD) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
ifeq ($(DEBUG),)
$(STRIP) $@
endif
.c.o:
$(MYCC) -c $< -o $@
install:
install -d -D -m 755 "$(DESTDIR)$(BINDIR)"
install -D -m 755 "$(TARGET)" "$(DESTDIR)$(BINDIR)"
install -d -D -m 755 "$(DESTDIR)$(DATADIR)"
cp -R data "$(DESTDIR)$(DATADIR)"
cp -R packs "$(DESTDIR)$(DATADIR)"
cp -R ./tools/releaser/data/gcw0/* "$(DESTDIR)$(DATADIR)"
find "$(DESTDIR)$(DATADIR)" -type d -exec chmod 755 {} \;
find "$(DESTDIR)$(DATADIR)" -type f \! -executable -exec chmod 644 {} \;
install -d "$(DESTDIR)$(MANDIR)man6/"
install -m 644 doc/wizznic.6 "$(DESTDIR)$(MANDIR)man6/"
mksquashfs $(DESTDIR) $(OPKNAME)_GCW0_$(RELEASE_VERSION)_$(BUILD_NUMBER).opk -all-root -noappend -no-exports -no-xattrs
clean:
rm -f $(NAME) src/*.o src/platform/*.o src/list/*.o
rm -Rf $(DESTDIR)
rm -f $(TARGET)
rm -f $(OPKNAME)_GCW0_$(RELEASE_VERSION)_$(BUILD_NUMBER).opk