Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Nov 2017 05:23:36 +0800
From:      blubee blubeeme <gurenchan@gmail.com>
To:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   a project with custom makefile
Message-ID:  <CALM2mEmzY8uNpbjfP5DUTd1YEMxbtjyA0zaz%2Bhkd9UM6jZHuzQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I have a port that has different directories each with it's own makefile
that creates some binaries in subdir/bin

A typical makefile from this project looks like this:
-------------------------------------------------------
# Install
BIN = x11

# Flags
CFLAGS = -std=c89 -pedantic -O2 `pkg-config --cflags --libs x11`

SRC = main.c
OBJ = $(SRC:.c=.o)

$(BIN):
@mkdir -p bin
rm -f bin/$(BIN) $(OBJS)
$(CC) $(SRC) $(CFLAGS) -o bin/$(BIN) -lX11 -lm
-------------------------------------------------------

There's a few things that I need to do to this makefile to make it work
first I have to remove -lX11 and -lm from the $(CC) line

second I have to add `pkg-config --cflags --libs x11` to the CFLAGS line.

if I go into the folder and run make, it builds and put the executable in
the bin directory inside that sub folder.

when I make the edits as listed above and then try to use FreeBSD Makefile.

OPTIONS_DEFINE= X11

x11_DESC=                     X11 sample


.include <bsd.port.pre.mk>
do-build:
.if ${PORT_OPTIONS:Mx11}
@(${DO_MAKE_BUILD} -C ${WRKSRC}/demo/x11/)
.endif
.include <bsd.port.post.mk>

This DO_MAKE_BUILD command builds the executable and puts it in the
subdir/bin folder but I get an error cannot open Makefile.

/usr/local/include/X11/Xfuncproto.h:174:24: warning: named variadic macros
are a GNU extension [-Wvariadic-macros]
#define _X_NONNULL(args...)  __attribute__((nonnull(args)))
                       ^
1 warning generated.
===>  Staging for nuklear-1.0
===>   Generating temporary packing list
make[2]: cannot open Makefile.

Is there a straight forward way to fix this issue or do I need to write a
makefile or cmake file and try to get that upstream?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALM2mEmzY8uNpbjfP5DUTd1YEMxbtjyA0zaz%2Bhkd9UM6jZHuzQ>