From owner-freebsd-ports@freebsd.org Fri Nov 24 22:15:49 2017 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13B14DF2DE1 for ; Fri, 24 Nov 2017 22:15:49 +0000 (UTC) (envelope-from adamw@adamw.org) Received: from apnoea.adamw.org (apnoea.adamw.org [104.225.5.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "apnoea.adamw.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6107966CB6 for ; Fri, 24 Nov 2017 22:15:48 +0000 (UTC) (envelope-from adamw@adamw.org) Received: by apnoea.adamw.org (OpenSMTPD) with ESMTPSA id 0e17b627 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Fri, 24 Nov 2017 15:15:41 -0700 (MST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.1 \(3445.4.7\)) Subject: Re: a project with custom makefile From: Adam Weinberger In-Reply-To: Date: Fri, 24 Nov 2017 15:15:40 -0700 Cc: FreeBSD Ports Content-Transfer-Encoding: quoted-printable Message-Id: <90470926-1E50-4CD9-A797-9D013B9B68D5@adamw.org> References: To: blubee blubeeme X-Mailer: Apple Mail (2.3445.4.7) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Nov 2017 22:15:49 -0000 > On 24 Nov, 2017, at 14:23, blubee blubeeme = 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 > do-build: > .if ${PORT_OPTIONS:Mx11} > @(${DO_MAKE_BUILD} -C ${WRKSRC}/demo/x11/) > .endif > .include >=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