Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Nov 2017 15:15:40 -0700
From:      Adam Weinberger <adamw@adamw.org>
To:        blubee blubeeme <gurenchan@gmail.com>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: a project with custom makefile
Message-ID:  <90470926-1E50-4CD9-A797-9D013B9B68D5@adamw.org>
In-Reply-To: <CALM2mEmzY8uNpbjfP5DUTd1YEMxbtjyA0zaz%2Bhkd9UM6jZHuzQ@mail.gmail.com>
References:  <CALM2mEmzY8uNpbjfP5DUTd1YEMxbtjyA0zaz%2Bhkd9UM6jZHuzQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> On 24 Nov, 2017, at 14:23, blubee blubeeme <gurenchan@gmail.com> =
wrote:
>=20
> I have a port that has different directories each with it's own =
makefile
> that creates some binaries in subdir/bin
>=20
> A typical makefile from this project looks like this:
> -------------------------------------------------------
> # Install
> BIN =3D x11
>=20
> # Flags
> CFLAGS =3D -std=3Dc89 -pedantic -O2 `pkg-config --cflags --libs x11`
>=20
> SRC =3D main.c
> OBJ =3D $(SRC:.c=3D.o)
>=20
> $(BIN):
> @mkdir -p bin
> rm -f bin/$(BIN) $(OBJS)
> $(CC) $(SRC) $(CFLAGS) -o bin/$(BIN) -lX11 -lm
> -------------------------------------------------------
>=20
> 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
>=20
> second I have to add `pkg-config --cflags --libs x11` to the CFLAGS =
line.

So put patches in files/, or use REINPLACE_CMD. Read the Porter's =
Handbook for instructions on how to do this.

> if I go into the folder and run make, it builds and put the executable =
in
> the bin directory inside that sub folder.
>=20
> when I make the edits as listed above and then try to use FreeBSD =
Makefile.
>=20
> OPTIONS_DEFINE=3D X11
>=20
> x11_DESC=3D                     X11 sample
>=20
>=20
> .include <bsd.port.pre.mk>
> do-build:
> .if ${PORT_OPTIONS:Mx11}
> @(${DO_MAKE_BUILD} -C ${WRKSRC}/demo/x11/)
> .endif
> .include <bsd.port.post.mk>
>=20
> This DO_MAKE_BUILD command builds the executable and puts it in the
> subdir/bin folder but I get an error cannot open Makefile.
>=20
> /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.
> =3D=3D=3D>  Staging for nuklear-1.0
> =3D=3D=3D>   Generating temporary packing list
> make[2]: cannot open Makefile.
>=20
> 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?

Most likely, there's no Makefile in WRKSRC. Either override do-install, =
add in a working Makefile, or change WRKSRC to somewhere with a =
Makefile.

"blubee", you have a habit of asking lots of questions and not giving us =
the Makefile. It's very hard to give you answers without all the =
context. Please, give us the Makefile when you are asking for help with =
a Makefile.

# Adam


--=20
Adam Weinberger
adamw@adamw.org
https://www.adamw.org




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?90470926-1E50-4CD9-A797-9D013B9B68D5>