From owner-freebsd-questions Mon Mar 25 5:28:26 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mail.ycn.com (mail.ycn.com [212.88.160.3]) by hub.freebsd.org (Postfix) with ESMTP id 0411537B41B for ; Mon, 25 Mar 2002 05:28:18 -0800 (PST) Received: from ws01 (212-88-187-192.ADSL.ycn.com [212.88.187.192]) by mail.ycn.com (8.11.3/8.9.3/Debian 8.9.3-21) with SMTP id g2PDTA716946 for ; Mon, 25 Mar 2002 14:29:11 +0100 From: "Richard Kaestner" To: Subject: help with make please! Date: Mon, 25 Mar 2002 14:41:18 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I already thought, I understood Unix-make (specially FreeBSD make), and then ... I could bang my head against the wall, but I don't get it working: Having kind of a source tree for an application: + with Makefile | + with lots of includes + with some c-sources and its makefile + with some c-sources and its makefile ... + supposed to hold object-files Could anybody please give me kind of "idiot's" recipie to create a working Makefile ? After so many attempts to get it running, I feel already ashamed to post my current makefile ... however, here it is (if it helps) <<<<< START of (ugly, terrible, ...) makefile <<<<< TARGET = XYZ.cgi #SOURCES = main.c debug.c config.c #SOURCES += KdSuch.c KdSuchDISPLAY.c KdSuchDB.c #SOURCES += KdEdit.c KdEditDisplayForm.c KdEditDB.c KdEditTEMP.c #SOURCES += globaldata.c page_utils.c OBJECTS = obj/cfg.o obj/rfk_string.o obj/hash.o OBJECTS += obj/globaldata.o obj/page_utils.o obj/debug.o obj/config.o OBJECTS += obj/main.o OBJECTS += obj/KdCommon.o OBJECTS += obj/KdSuch.o obj/KdSuchDISPLAY.o obj/KdSuchDB.o OBJECTS += obj/KdEdit.o obj/KdEditDisplayForm.o obj/KdEditDB.o obj/KdEditTEMP.o HFILES = inc/Application.h inc/main.h inc/debug.h inc/formdefs.h inc/globaldata.h HFILES += inc/page_utils.h inc/config.h HFILES += inc/cfg.h inc/hash.h inc/rfk_string.h HFILES += inc/KdEdit.h inc/KdSuch.h HTML_H_FILES = KdSuch/html/KdSuchFORM.h KdEdit/html/KdEditFORM.h SUBDIR = lib SUBDIR += utils SUBDIR += Main SUBDIR += KdCommon SUBDIR += KdSuch SUBDIR += KdEdit # spezifische Regeln: CGI_DIR = /rfk/web/XYZ/cgi-bin/ HTML_DIR = /rfk/web/XYZ/html/ ICON_DIR = /rfk/web/XYZ/icons/ .SUFFIXES: .c # Compiler: CC = gcc CPLUS = g++ # see also: env: C_INCLUDE_PATH, CPLUS_INCLUDE_PATH INCLUDE = -I. -Iinc/ INCLUDE += -I/usr/local/include/ INCLUDE += -I/usr/local/include/mysql INCLUDE += -I/usr/local/include/ecgi CFLAGS = -g -Wall -ansi $(INCLUDE) # release flags: #CFLAGS = -O2 -Wall -ansi $(INCLUDE) OUTPUT_OPTION = -o $@ # Linker: (also set env: LIBRARY_PATH) LINKFLAGS = -lecgi -lmysqlclient LINKFLAGS += -L/usr/local/lib/ -L/usr/local/lib/mysql #LINKFLAGS += -L. #compileme = dos2unix $< ; compileme = $(CC) $(CFLAGS) -c $< -o $@ ; cp $@ .. # ********************* TARGETS *************************** all: $(HTMLFILES) $(TARGET) echo " --------->>> MAKE ALL done <<<<" clean: rm -fv obj/*.o $(CGI_DIR)/*.core cleanhtml: rm -fv $(HTML_H_FILES) convert: dos2unix *.c *.h .for _targets in $(SUBDIR) cd ${_target} make .endfor # ist allgemeines Ziel (installieren, ... $(TARGET): $(OBJECTS) $(CC) $(OUTPUT_OPTION) \ $(LINKFLAGS) $(CFLAGS) \ $(OBJECTS) cp XYZ.cgi $(CGI_DIR)XYZ.cgi #.include "lib/Makefile" #.include "utils/Makefile" #.include "KdCommon/Makefile" #.include "KdEdit/Makefile" #.include "KdSuch/Makefile" #.include "Main/Makefile" <<<<< END of (ugly, terrible, ...) makefile <<<<< -- ciao - Richard "you have moved your mouse, please reboot to make this change take effect" Richard Kästner Woerthgasse 17 2500 Baden mailto:richard.kaestner@ycn.com Austria To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message