Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There may have some error in the makefile #3

Open
reee opened this issue Apr 9, 2016 · 1 comment
Open

There may have some error in the makefile #3

reee opened this issue Apr 9, 2016 · 1 comment

Comments

@reee
Copy link

reee commented Apr 9, 2016

TARGET = libcedrus.so.1
SRC = cedrus.c cedrus_mem_ve.c cedrus_mem_ion.c
INC = cedrus.h cedrus_regs.h
CFLAGS ?= -Wall -Wextra -O3
LDFLAGS ?=
LIBS = -lpthread
CC ?= gcc

prefix ?= usr/local
libdir ?= $(prefix)/lib
includedir ?= $(prefix)/include

ifeq ($(USE_UMP),1)
SRC += cedrus_mem_ump.c
CFLAGS += -DUSE_UMP
LIBS += -lUMP
endif

DEP_CFLAGS = -MD -MP -MQ $@
LIB_CFLAGS = -fpic -fvisibility=hidden
LIB_LDFLAGS = -shared -Wl,-soname,$(TARGET)

OBJ = $(addsuffix .o,$(basename $(SRC)))
DEP = $(addsuffix .d,$(basename $(SRC)))

.PHONY: clean all install uninstall

all: $(TARGET)
$(TARGET): $(OBJ)
$(CC) $(LIB_LDFLAGS) $(LDFLAGS) $(OBJ) $(LIBS) -o $@

clean:
rm -f $(OBJ)
rm -f $(DEP)
rm -f $(TARGET)

install: $(TARGET) $(INC)
install -D $(TARGET) $(DESTDIR)/$(libdir)/$(TARGET)
ln -sf $(TARGET) $(DESTDIR)/$(libdir)/$(basename $(TARGET))
install -D -t $(DESTDIR)/$(includedir)/cedrus/ $(INC)

uninstall:
rm -f $(DESTDIR)/$(libdir)/$(basename $(TARGET))
rm -f $(DESTDIR)/$(libdir)/$(TARGET)
rm -rf $(DESTDIR)/$(includedir)/cedrus

%.o: %.c
$(CC) $(DEP_CFLAGS) $(LIB_CFLAGS) $(CFLAGS) -c $< -o $@

include $(wildcard $(DEP))

  1. There is no definition for $(DESTDIR) so is it not needed? the path actually is '//usr/local/lib/libcedrus.so.1' on my cubietruck with ubuntu desktop from armbian
  2. We may need create the dir /usr/local/include/cedrus/ before we could copy file to it?
@jemk
Copy link
Member

jemk commented Apr 11, 2016

  1. You have to define DESTDIR if you need it, see https://www.gnu.org/prep/standards/html_node/DESTDIR.html
  2. install -D should take care of creating the directories according to its manpage. But it looks like this doesn't apply to older versions...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants