mirror of
https://github.com/BertoldVdb/ZoneDetect.git
synced 2026-04-26 14:47:41 +00:00
Merge pull request #17 from flederwiesel/master
Add support for cross-compile and debug build
This commit is contained in:
commit
a214a3bd13
2 changed files with 17 additions and 5 deletions
3
library/.gitignore
vendored
Normal file
3
library/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
libzonedetect.dll
|
||||
libzonedetect.so
|
||||
zonedetect.o
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
CC?=$(CCARCH)gcc
|
||||
STRIP?=$(CCARCH)strip
|
||||
|
||||
CFLAGS=-fPIC -O3 -std=gnu99 -pedantic -Wall -Wextra -Wconversion -Werror -c -fmessage-length=0 -ffunction-sections -fdata-sections
|
||||
CFLAGS=-fPIC $(if $(DEBUG),-O0 -g,-O3) -std=gnu99 -pedantic -Wall -Wextra -Wconversion -Werror -c -fmessage-length=0 -ffunction-sections -fdata-sections
|
||||
LDFLAGS=-shared
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
|
|
@ -36,6 +36,10 @@ else
|
|||
EXT=so
|
||||
endif
|
||||
|
||||
prefix ?= /usr
|
||||
libdir ?= $(prefix)/lib
|
||||
includedir ?= $(prefix)/include
|
||||
|
||||
EXECUTABLE=libzonedetect.$(EXT)
|
||||
INCLUDES_SRC=zonedetect.h
|
||||
SOURCES_SRC=zonedetect.c
|
||||
|
|
@ -43,11 +47,13 @@ SOURCES_SRC=zonedetect.c
|
|||
|
||||
OBJECTS_OBJ=$(SOURCES_SRC:.c=.o)
|
||||
|
||||
.PHONY: all install clean nice
|
||||
|
||||
all: $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS_OBJ)
|
||||
$(CC) $(LDFLAGS) $(OBJECTS_OBJ) -o $@
|
||||
$(STRIP) $@
|
||||
$(if $(DEBUG),,$(STRIP) $@)
|
||||
|
||||
|
||||
obj/%.o: src/%.c $(INCLUDES_SRC)
|
||||
|
|
@ -57,9 +63,12 @@ clean:
|
|||
rm -rf $(OBJECTS_OBJ) $(EXECUTABLE)
|
||||
|
||||
install:
|
||||
cp zonedetect.h /usr/include/
|
||||
cp $(EXECUTABLE) /usr/lib/
|
||||
ldconfig
|
||||
install -m 0755 -d $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)
|
||||
install -m 0644 -t $(DESTDIR)$(includedir) zonedetect.h
|
||||
install -m 0644 -t $(DESTDIR)$(libdir) $(EXECUTABLE)
|
||||
# Assuming DESTDIR is set for cross-installing only, we don't need
|
||||
# (and probably do not have) ldconfig
|
||||
$(if $(DESTDIR),,ldconfig)
|
||||
|
||||
nice:
|
||||
mkdir -p bak/
|
||||
|
|
|
|||
Loading…
Reference in a new issue