Date: Mon, 25 Mar 2002 14:41:18 +0100 From: "Richard Kaestner" <richard.kaestner@ycn.com> To: <freebsd-questions@FreeBSD.ORG> Subject: help with make please! Message-ID: <C1F8152FC5A1D31196510000B430148603103A@saturn>
index | next in thread | raw e-mail
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:
+ <root> with Makefile
|
+ <inc> with lots of includes
+ <KdSuch> with some c-sources and its makefile
+ <KdEdit> with some c-sources and its makefile
...
+ <obj> 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
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C1F8152FC5A1D31196510000B430148603103A>
