Skip to content

Commit

Permalink
OS-6231 smartos-live should use existing copy of custr
Browse files Browse the repository at this point in the history
OS-6232 smartos-live src/Makefile doesn't pass DESTDIR correct to subdirs
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
Approved by: Joshua M. Clulow <jmc@joyent.com>
  • Loading branch information
Jason King authored and jasonbking committed Jul 21, 2017
1 parent 619da21 commit 29d5805
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 28 deletions.
5 changes: 3 additions & 2 deletions src/Makefile
Expand Up @@ -10,7 +10,7 @@
#

#
# Copyright 2017 Joyent, Inc.
# Copyright (c) 2017, Joyent, Inc.
#

include Makefile.defs
Expand Down Expand Up @@ -39,7 +39,8 @@ JSSTYLE_OLDSKOOL_OPTS =
# without extra effort; it is overridden when make is invoked in this
# subdirectory.
#
DESTDIR = ../proto
# This should be an absolute path, or building $(SUBDIRS) will fail
DESTDIR = $(realpath ../proto)

#
# DESTNAME is used for the manifest target. We set it to something
Expand Down
5 changes: 3 additions & 2 deletions src/common/strings/Makefile
Expand Up @@ -10,7 +10,7 @@
#

#
# Copyright 2015 Joyent, Inc.
# Copyright (c) 2017, Joyent, Inc.
#

#
Expand Down Expand Up @@ -44,6 +44,7 @@ TEST_PROGRAMS = \
TEST_BINS = $(TEST_PROGRAMS:%=obj/%)

STRINGS_OBJECTS = \
custr.o \
strlist.o \
strpath.o

Expand All @@ -56,7 +57,7 @@ CTFMERGE = /usr/bin/true
CC = $(GCC)
CSTYLE = ../../../tools/cstyle

LIBS = -lcmdutils -lumem
LIBS = -lumem

COMPILE_C = $(CC) $(CPPFLAGS) $(LDFLAGS) $(CFLAGS) -c -o $@ $< $(LIBS)

Expand Down
2 changes: 1 addition & 1 deletion tools/common/custr.c → src/common/strings/custr.c
Expand Up @@ -23,7 +23,7 @@
*/

/*
* Copyright 2015 Joyent, Inc.
* Copyright (c) 2017, Joyent, Inc.
*/

#include <stdlib.h>
Expand Down
4 changes: 3 additions & 1 deletion tools/common/custr.h → src/common/strings/custr.h
Expand Up @@ -10,7 +10,7 @@
*/

/*
* Copyright 2015 Joyent, Inc.
* Copyright (c) 2017, Joyent, Inc.
*/

#ifndef _CUSTR_H
Expand All @@ -20,6 +20,8 @@
* Private copy of custr*() utilities from libcmdutils.
*/

#include <stddef.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
5 changes: 2 additions & 3 deletions src/common/strings/strpath.c
Expand Up @@ -10,14 +10,13 @@
*/

/*
* Copyright 2015 Joyent, Inc.
* Copyright (c) 2017, Joyent, Inc.
*/

/*
* smartos-live: Path manipulation utility functions.
*/

#include <libcmdutils.h>
#include "custr.h"

/*
* Append a path string, "inp", to the end of the path string already present
Expand Down
4 changes: 2 additions & 2 deletions src/common/strings/strpath.h
Expand Up @@ -10,7 +10,7 @@
*/

/*
* Copyright 2015 Joyent, Inc.
* Copyright (c) 2017, Joyent, Inc.
*/

#ifndef _STRPATH_H
Expand All @@ -20,7 +20,7 @@
* smartos-live: Path manipulation utility functions.
*/

#include "libcmdutils.h"
#include "custr.h"

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions src/common/strings/tests/testpath.c
Expand Up @@ -10,7 +10,7 @@
*/

/*
* Copyright 2015 Joyent, Inc.
* Copyright (c) 2017, Joyent, Inc.
*/

#include <stdio.h>
Expand All @@ -20,8 +20,8 @@
#include <err.h>
#include <errno.h>
#include <sys/debug.h>
#include <libcmdutils.h>

#include "custr.h"
#include "strpath.h"

typedef struct {
Expand Down
8 changes: 4 additions & 4 deletions src/dockerinit/Makefile
Expand Up @@ -10,7 +10,7 @@
#

#
# Copyright 2015 Joyent, Inc.
# Copyright (c) 2017, Joyent, Inc.
#

BASE := $(PWD)
Expand All @@ -28,12 +28,12 @@ GXX = $(NATIVEDIR)/usr/bin/g++
SYSINCDIRS = /usr/include
SYSLIBDIRS = /usr/lib /lib

CPPFLAGS = $(SYSINCDIRS:%=-isystem $(DESTDIR)/%) -D_LARGEFILE64_SOURCE
CPPFLAGS = $(SYSINCDIRS:%=-isystem $(DESTDIR)/%)
LDFLAGS = $(SYSLIBDIRS:%=-L$(DESTDIR)/%) \
-Wl,-zassert-deflib -Wl,-zfatal-warnings

JSON_OBJS = json-nvlist.o
JSON_LIBS = -lnvpair -lcmdutils
JSON_LIBS = -lnvpair

MDATA_OBJS = \
mdata-client/dynstr.o \
Expand All @@ -48,7 +48,7 @@ MDATA_LIBS = -lnsl -lsocket -lsmbios

NET_LIBS = -lipadm -linetutil -lnsl -lsocket

STRINGS_OBJS = strlist.o strpath.o
STRINGS_OBJS = custr.o strlist.o strpath.o

DOCKER_OBJS = docker-common.o

Expand Down
3 changes: 2 additions & 1 deletion src/dockerinit/json-nvlist/json-nvlist.c
Expand Up @@ -10,7 +10,7 @@
*/

/*
* Copyright 2015 Joyent, Inc.
* Copyright (c) 2017, Joyent, Inc.
*/

#include <stdio.h>
Expand All @@ -21,6 +21,7 @@
#include <libnvpair.h>
#include <sys/ccompile.h>

#include "custr.h"
#include "json-nvlist.h"

typedef enum json_type {
Expand Down
3 changes: 1 addition & 2 deletions src/dockerinit/json-nvlist/json-nvlist.h
Expand Up @@ -10,14 +10,13 @@
*/

/*
* Copyright 2015 Joyent, Inc.
* Copyright (c) 2017, Joyent, Inc.
*/

#ifndef _JSON_NVLIST_H
#define _JSON_NVLIST_H

#include <libnvpair.h>
#include <libcmdutils.h>

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions src/dockerinit/src/docker-common.h
Expand Up @@ -5,7 +5,7 @@
*/

/*
* Copyright (c) 2016, Joyent, Inc.
* Copyright (c) 2017, Joyent, Inc.
*/

/*
Expand All @@ -29,7 +29,7 @@
#define DOCKER_COMMON_H

#include <libnvpair.h>
#include <libcmdutils.h>
#include "custr.h"
#include "../json-nvlist/json-nvlist.h"
#include "strlist.h"

Expand Down
1 change: 1 addition & 0 deletions src/dockerinit/src/dockerinit.c
Expand Up @@ -28,6 +28,7 @@
* problems.
*/

#include <dirent.h>
#include <door.h>
#include <errno.h>
#include <fcntl.h>
Expand Down
13 changes: 10 additions & 3 deletions src/routeinfo/Makefile
Expand Up @@ -10,7 +10,7 @@
#

#
# Copyright 2015 Joyent, Inc.
# Copyright (c) 2017, Joyent, Inc.
#

BASE := $(PWD)
Expand All @@ -32,6 +32,7 @@ CPPFLAGS = $(SYSINCDIRS:%=-isystem $(DESTDIR)/%)
LDFLAGS = $(SYSLIBDIRS:%=-L$(DESTDIR)/%) \
-Wl,-zassert-deflib -Wl,-zfatal-warnings

STRINGS_DIR = $(BASE)/../common/strings
DOCKER_DIR = $(BASE)/../dockerinit

ROUTEINFO_OBJECTS = \
Expand All @@ -47,16 +48,18 @@ MDATA_OBJECTS = \
sunos.o \
unix_common.o

custr.o : CFLAGS += -I$(STRINGS_DIR)
mdata_%.o : CFLAGS += -I$(DOCKER_DIR)/mdata-client -D__HAVE_BOOLEAN_T

OBJECTS = \
$(MDATA_OBJECTS:%=mdata_%) \
custr.o \
json-nvlist.o \
main.o

json-nvlist.o : CFLAGS += -I$(DOCKER_DIR)/json-nvlist
json-nvlist.o : CFLAGS += -I$(DOCKER_DIR)/json-nvlist -I$(STRINGS_DIR)

LIBS = -lnvpair -lnsl -lsocket -lsmbios -lcmdutils
LIBS = -lnvpair -lnsl -lsocket -lsmbios

CTFCONVERT = /usr/bin/true
CTFMERGE = /usr/bin/true
Expand Down Expand Up @@ -93,6 +96,10 @@ $(PROGRAM): $(OBJECTS)
$(CC) $(CPPFLAGS) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
$(CTFMERGE) -L VERSION -o $@ $(OBJECTS)

%.o: $(STRINGS_DIR)/%.c
$(COMPILE_C)
$(CTFCONVERT) -L VERSION $@

mdata_%.o: $(DOCKER_DIR)/mdata-client/%.c
$(COMPILE_C)
$(CTFCONVERT) -L VERSION $@
Expand Down
3 changes: 1 addition & 2 deletions src/routeinfo/main.c
Expand Up @@ -10,7 +10,7 @@
*/

/*
* Copyright 2015 Joyent, Inc.
* Copyright (c) 2017, Joyent, Inc.
*/

/*
Expand All @@ -36,7 +36,6 @@
#include <err.h>

#include <libnvpair.h>
#include <libcmdutils.h>

#include <json-nvlist/json-nvlist.h>
#include <mdata-client/common.h>
Expand Down
4 changes: 3 additions & 1 deletion tools/tzcheck/main.c
Expand Up @@ -10,7 +10,7 @@
*/

/*
* Copyright 2016 Joyent, Inc.
* Copyright (c) 2017, Joyent, Inc.
*/

/*
Expand All @@ -35,6 +35,8 @@
#include <dirent.h>
#include <ctype.h>
#include <sys/avl.h>
#include <limits.h>
#include <unistd.h>

#include "common.h"
#include "parser.h"
Expand Down

0 comments on commit 29d5805

Please sign in to comment.