Skip to content

Commit

Permalink
Relocate include files to include/ and update Makefile accordingly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joachim Nilsson committed Oct 16, 2010
1 parent 8dcb2a2 commit 1503b62
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 26 deletions.
75 changes: 56 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,78 @@
# INADYN Makefile
# Makefile for INADYN, a simple and small ddns client. -*-Makefile-*-

#VERSION ?= $(shell git tag -l | tail -1)
VERSION ?= 1.96.2
NAME = inadyn
EXEC = src/$(NAME)
PKG = $(EXEC)-$(VERSION)
ARCHIVE = $(PKG).tar.bz2
MAN5 = inadyn.conf.5
MAN8 = inadyn.8

ROOTDIR ?= $(dir $(shell pwd))
RM ?= rm -f
CC ?= $(CROSS)gcc

prefix ?= /usr/local
sysconfdir ?= /etc
datadir = $(prefix)/share/doc/inadyn
mandir = $(prefix)/share/man

# This magic trick looks like a comment, but works on BSD PMake
#include <config.mk>
include config.mk

OUTFILE = $(OUTDIR)/$(TARGET_ARCH)/inadyn
BASE_OBJS = $(OUTDIR)/base64utils.o $(OUTDIR)/dyndns.o $(OUTDIR)/errorcode.o \
$(OUTDIR)/get_cmd.o $(OUTDIR)/http_client.o $(OUTDIR)/ip.o $(OUTDIR)/main.o \
$(OUTDIR)/os_unix.o $(OUTDIR)/os_windows.o $(OUTDIR)/os.o $(OUTDIR)/os_psos.o \
$(OUTDIR)/tcp.o $(OUTDIR)/inadyn_cmd.o
BASE_OBJS = src/base64utils.o src/dyndns.o src/errorcode.o src/get_cmd.o \
src/http_client.o src/ip.o src/main.o src/os_unix.o src/os_windows.o \
src/os.o src/os_psos.o src/tcp.o src/inadyn_cmd.o
OBJS = $(BASE_OBJS) $(CFG_OBJ) $(EXTRA_OBJS)
CFLAGS += $(CFG_INC) $(EXTRA_CFLAGS)
CFLAGS = -Iinclude $(CFG_INC) $(EXTRA_CFLAGS)
CFLAGS += -O2 -W -Wall
LDLIBS += $(EXTRA_LIBS)
DISTFILES = README COPYING LICENSE

# Pattern rules
$(OUTDIR)/%.o : $(SRCDIR)/%.c
.c.o:
@printf " CC $@\n"
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<

# Build rules
all: $(OUTFILE)
all: $(EXEC)

$(OUTFILE): $(OUTDIR)/$(TARGET_ARCH) $(OBJS)
$(EXEC): $(OBJS)
@printf " LINK $@\n"
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)

$(OUTDIR)/$(TARGET_ARCH):
-@mkdir -p "$@"
install: $(EXEC)
@install -d $(DESTDIR)$(prefix)/sbin
@install -d $(DESTDIR)$(sysconfdir)
@install -d $(DESTDIR)$(datadir)
@install -d $(DESTDIR)$(mandir)/man8
@install -d $(DESTDIR)$(mandir)/man5
@install -m 0755 $(EXEC) $(DESTDIR)$(prefix)/sbin/
@install -m 0644 man/MAN5 $(DESTDIR)$(mandir)/man5/MAN5
@install -m 0644 man/MAN8 $(DESTDIR)$(mandir)/man8/MAN8
@for file in $(DISTFILES); do \
install -m 0644 $$file $(DESTDIR)$(datadir)/$$file; \
done

# Rebuild this project
rebuild: cleanall all
uninstall:
-@$(RM) $(DESTDIR)$(prefix)/sbin/$(EXEC)
-@$(RM) -r $(DESTDIR)$(datadir)
-@$(RM) $(DESTDIR)$(mandir)/man5/MAN5
-@$(RM) $(DESTDIR)$(mandir)/man8/MAN8

# Clean this project
clean:
-@rm -f $(OUTFILE)
-@rm -f $(OBJS)
-@$(RM) $(OBJS) $(EXECS)

distclean:
-@$(RM) $(OBJS) core $(EXECS) *.o *.map .*.d *.out tags TAGS

dist:
@echo "Building bzip2 tarball of $(PKG) in parent dir..."
git archive --format=tar --prefix=$(PKG)/ $(VERSION) | bzip2 >../$(ARCHIVE)
@(cd ..; md5sum $(ARCHIVE))

# Clean this project and all dependencies
cleanall: clean
build-deb:
git-buildpackage --git-ignore-new --git-upstream-branch=master

7 changes: 0 additions & 7 deletions config.mk
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Make command to use for dependencies
MAKECMD = make

INADYN_BASE = .
SRCDIR = $(INADYN_BASE)/src
OUTDIR = bin

# Oversimplified arch setup, no smart detection.
# Possible values: linux, mac, solaris, yourown
ifndef TARGET_ARCH
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1503b62

Please sign in to comment.